如何在服务器端重定向,而componentWillMount?
static contextTypes = {
router: React.PropTypes.any
};
static needs = [
EventActions.getEvent
];
componentWillMount() {
if(this.props.event.get('redirect')) {
let path = this.props.event.get('redirect');
this.context.router.push(this.props.event.get('redirect'));
//console.log(this.context);
}
}
什么都没发生。没有警告。网址是相对的。 子组件开始渲染。这个组件是容器。