在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5  HTML/ create-react-APP中登錄頁面怎么跳到后臺首頁

create-react-APP中登錄頁面怎么跳到后臺首頁

1.開始是在index.js的render中切換

clipboard.png

2.現在需要在登錄頁面登錄成功后跳的后臺首頁

clipboard.png
一直沒跳成功,剛開始學習,希望給點建議。。。

回答
編輯回答
夕顏

react-router 了解一下嗎?

2018年4月24日 23:40
編輯回答
愛礙唉

不用路由也可以解決這個問題。

你做一個<App />組件,把<Lists /><Login />作為其子組件。在<App />render()函數內定義判斷邏輯,然后把index.js里掛載的那句話改成:

ReactDOM.render(<App />, document.getElementById('contain'));
2017年12月12日 19:49
編輯回答
祈歡

使用路由正解
this.props.history.push(/home);

2017年5月9日 10:09
編輯回答
下墜

創(chuàng)建文件 newfile.js

import createHistory from 'history/createBrowserHistory'
export default createHistory()

在 login 組件導入適用

import History from 'newfile'

// 使用
History.push('/routerpath/xxx')

ps: 借一樓兄臺的話, react-router 了解一下

2017年9月4日 08:21
編輯回答
別硬撐

我有一篇文章不知騷年看不看https://segmentfault.com/a/11...

2017年4月2日 00:55