我是 React js 的新手,我正在为我的项目使用哈希路由,我有一个登录页面和仪表板。当我单击登录按钮时,我应该重定向到仪表板。
目前,当我单击登录按钮时,网址从“ http://localhost:8080/#/login ”更改为http://localhost:8080/#/dashboard - 但页面未呈现..:(
这是我用来推送的代码 - store.dispatch(push('#/dashboard'));
使用此链接进行配置 - https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux
const history = createHistory();
const middleware = routerMiddleware(history);
const sagaMiddleware = createSagaMiddleware(); //saga
export const store = createStore(combineReducers({ login: L_reducer, router: routerReducer }),applyMiddleware(sagaMiddleware,middleware));
//no error
sagaMiddleware.run(watcherSaga);
ReactDOM.render((
<Provider store={store}>
<ConnectedRouter history={history}>
<HashRouter>
<Switch>
<Route exact path="/login" name="Login Page" component={Login}/>
<Route exact path="/register" name="Register Page" component={Register}/>
<Route path="/" name="Home" component={Full}/>
</Switch>
</HashRouter>
</ConnectedRouter>
</Provider>
), document.getElementById('root'));
Run Code Online (Sandbox Code Playgroud) 我知道这是一个简单的问题,但我想得到这样的结果。
3/6 = 0.500000
将两个数字相除并在单个变量中返回商和提醒,我如何快速实现上述目标?