With react-router
I can use the Link
element to create links which are natively handled by react router.
I see internally it calls t
Here's how you do this with react-router v2.0.0 with ES6. react-router
has moved away from mixins.
import React from 'react';
export default class MyComponent extends React.Component {
navigateToPage = () => {
this.context.router.push('/my-route')
};
render() {
return (
);
}
}
MyComponent.contextTypes = {
router: React.PropTypes.object.isRequired
}