Update the response with the new React Rout and Update React . Date of the day: 07/29/2017
All version:
"history": "^4.6.3", "react": "^15.6.1", "react-dom": "^15.6.1", "react-router": "^4.1.2", "react-router-dom": "^4.1.2", "webpack": "^3.3.0", "webpack-dev-server": "^2.5.1"
MY Rout Look LIke it ...
import {BrowserRouter,Route,Link} from 'react-router-dom'; // for BrowserRouter rout <BrowserRouter> <div> <Route exact path='/' component={Layout}></Route> <Route path='/about' name="about" component={about}> </Route> <Route path='/protfolio' name="protfolio" component={protfolio}></Route> </div> </BrowserRouter >
Read more about New Quick Launch Re-Routing
For Link View or Navigation View
<Link to="/about">Check rout link protfolio</Link> <Link to="/protfolio">Check rout link protfolio</Link> <button onClick={this.navigate.bind(this)}>button binf</button>
Final look:
navigate(){ this.props.history.replace('/', null); }
if you accept console.log(this.props.history); Then you get your browser console ...
push:function push(path, state)
So I can not use it like this.props.history.replace(null, '/');
Because the path is null here, this is not possible.
source share