Я пытаюсь выяснить, почему, если, скажем, я нахожусь в середине маршрута / страницы /current-path
, если я иду на /new-path
, то /new-path
загружается только в середине или в том же положении, где Я оставил старый путь. Обычное поведение должно быть, если я иду по новому маршруту, новый маршрут / страница должны загружаться сверху.
Я записал видео , чтобы вы увидели, о чем я говорю.
Если вы видите, в видео я иду по новому маршруту и, если я хочу пойти наверх, я должен прокрутить до него.
Это компонент, где у меня есть мои маршруты:
import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom';
// … rest of the imports here
const App = () => (
<ReduxProvider store={reduxStore}>
<Router>
<div className="App">
<div className="App-container">
<Switch>
<Route path="/applications" component={Applications} />
<Route path="/terms" component={Terms} />
<Route path="/signup" component={SignupPage} />
<Route path="/choose-profile" component={ChooseProfile} />
<Route path="/profile-completion" component={ProfileCompletion} />
<Route path="/investor-personal-profile" component={InvestorProfile} />
<Route path="/startup-application" component={StartupApplication} />
<Route path="/investor-application" component={InvestorApplication} />
<Route exact path="/startup/:startup" component={StartupProfile} />
<Route path="/search" component={SearchStartup} />
<Route exact path="/investor/search" component={SearchProfile} />
<Route path="/wiretransfer-instructions" component={WireTransfer} />
<Route exact path="/about-us" component={AboutUs} />
<Route exact path="/how-it-works" component={HowItWorks} />
<Route exact path="/faq" component={Faqs} />
<Route exact path="/:startup" component={StartupPublicProfile} />
<Route path="/" component={HomePage} />
</Switch>
</div>
</div>
<Footer />
</Router>
</ReduxProvider>
);
export default App;
Я уже пытался перейти на новый маршрут с Link
компонентом реакционного маршрутизатора, <Link to="/about-us">About Us</Link>
, а также вот так =>
<button onClick={() => history.push('/faq')}>
FAQ and Guides
</button>
Так что я могу делать не так?