We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在本项目中看到好多地方都定义了contextTypes, 这是在子组件里定义的,方便直接从祖先组件中获取需要的数据,然后再祖先组件中定义getChildContext,但是我怎么找也找不到哪里有定义getChildContext方法的地方,后来想到了这个应该是在Router组件定义的,因为所有组件都是Routet的子组件,一个使用案例如下
class Main extends Component { constructor(props) { super(props); this.signout = () => { this.props.signin(); this.context.router.replace({ pathname: '/' }); } } } Main.contextTypes = { router: React.PropTypes.object.isRequired };
The text was updated successfully, but these errors were encountered:
context.router是跳转的一种方式,可以查看issue #5
Sorry, something went wrong.
No branches or pull requests
在本项目中看到好多地方都定义了contextTypes, 这是在子组件里定义的,方便直接从祖先组件中获取需要的数据,然后再祖先组件中定义getChildContext,但是我怎么找也找不到哪里有定义getChildContext方法的地方,后来想到了这个应该是在Router组件定义的,因为所有组件都是Routet的子组件,一个使用案例如下
The text was updated successfully, but these errors were encountered: