Archives : December-2017

I have the next routes on main component of my app: <div> <h1><Link to="/">Home</Link></h1> <Switch> <Route exact path="/" component={FirstPage} /> <Route exact path="/:language?/second" component={SecondPage} /> <Route exact path="/:language?/account" component={AccountPage} /> <Route exact path="/:language?/add" component={AddNewPage} /> <Route component={NoMatch} /> </Switch> </div> I need to add in each child component checking this.props.match.params.language (this is react-router props) in ..

Read more

I was trying to create a <PrivateRoute> as describe in the react-router documents using TypeScript. Can anyone help me out? The privateRoute in react-router document: const PrivateRoute = ({ component: Component, …rest }) => ( <Route {…rest} render={props => ( fakeAuth.isAuthenticated ? ( <Component {…props}/> ) : ( <Redirect to={{pathname: ‘/login’, state: { from: props.location ..

Read more