以前在react SPA 项目中,我会通过react生命周期监听参数的变化,然后重新请求数据,但是服务端渲染没有此生命周期,如何监听?
原来的代码:
componentWillReceiveProps(nextProps) { const { location } = this.props; if (nextProps.location.pathname !== location.pathname) { this.setMetas();
}
}
慕码人2483693
随时随地看视频慕课网APP