在更新了我們的一堆依賴項之后,我們現在被迫使用導致重定向的錨標記,在我們使用之前但現在每次我們點擊它都會轉到正確的 url 即 /screens 但它只是一個空白頁面并且從不顯示組件,下面是我們的父 index.tsx 文件:ReactDOM.render( <Provider {...stores}> {/* Changed routes to children */} {/* <Router children={routes} history={createHistory} /> */} <Router history={createHistory}> <div> <Switch> <Route path='/oauth2callback' componentDidMount={console.log()}> {() => { if(window.location.href.includes('/oauth2callback')) { oauth2callback(window.location.hash) } }} </Route> <Route path='/testing' component={Get} /> <Route path='/'> {/* Function that determines if the user is logged in and can allow the authenticated passage or not. If no, it will not render authenticated pages*/} {() => { if(auth.loggedIn()) { console.log("is logged in") return( <div> <Route component={App} history={createHistory}/> <div className="row" id="wrapper"> <Switch> {/* <Route path='/screens' component={Screens}/> */} <Route path='/screens' component={Screens}/> <Route path='/playlists' component={Playlists}/> <Route path='/content' component={Content}/> <Route path='/help' component={HelpNav}/> <Route component={NotFound}/> </Switch> </div> </div> ) }知道新的反應路由器更新有什么不同導致這個錯誤存在嗎?
React Router 在使用 <Link> 時顯示空白頁面
慕娘9325324
2022-12-22 10:07:16