Archives : February-2018

How can I get the value of attribute defined in route? export default () => ( <Router> <App> <Route exact path="/" title="Home" componenet={Home} /> <Route exact path="/about" title="About" component={About} /> </App> </Router> ); I would like to get the title in app.js export default class App extends React.Component { componentDidMount() { console.log(this.props.title); } } However, ..

Read more

I’m relatively new to React and I’m wondering what’s the standard here. Imagine I have a react-router like this one: <Router history={history}> <Route path=”/” component={App}> <Route path=”home component={Home} /> <Route path=”about” component={About} /> <Route path=”inbox” component={Inbox} /> <Route path=”contacts” component={Contacts} /> </Route> </Router> And now I want to remove two routes if prop.mail is set ..

Read more

I’m trying to set up react-router in an example application, and I’m getting the following error: You should not use <Link> outside a <Router> My app is set up like so: Parent component const router = ( <div className=”sans-serif”> <Router histpry={browserHistory}> <Route path=”/” component={Main}> <IndexRoute component={PhotoGrid}></IndexRoute> <Route path=”/view/:postId” component={Single}></Route> </Route> </Router> </div> ); render(<Main />, ..

Read more