Answer the question
In order to leave comments, you need to log in
How to implement React.Navigation in a component?
Need to navigate in react. Application in ES6.
The question is how to inject mixins: [ Navigation ] into a react class?
I don't want to go to React.createClass({})
c class Main extend React.Components {}
Decided through context.
static contextTypes = {
router: PropTypes.object.isRequired
};
this.context.transitionTo('/')
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.
Answer the question
In order to leave comments, you need to log in
Decision.
In the component, get the router instance from the context.
static contextTypes = {
router: Router.PropTypes.object.isRequired
}
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?stage=0' },
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question