0
URLが変更されたときにReduxForm統合コンポーネントを再レンダリングしようとしていますが、コンポーネントは同じままです。Reduxフォーム - 同じコンポーネントからURLが変更された場合に再レンダリングする方法?
私はcomponentDidUpdate
ため
componentWillReceiveProps(nextProps){
if (this.props.history.location.pathname
!== nextProps.history.location.pathname){
console.log('here, new route but same component!');
}
だけでなく、同じことを試してみましたが、nextProps
とthis.props
は同じです! ReduxFormまたはconnect
は、URLが変更された場合でも、登録方法について全く混乱し、私を残して、コンポーネントのthis
オブジェクトを変更している -
componentDidUpdate(prevProps) {
console.log(this.props.location)
console.log(prevProps.location);
// These two are the same!
}
また、私はnextProps.params
にアクセスすることはできません。
私は「キャッシュ」それまでの状態にある変数に元this.props.history.location.pathnameを格納してみwindow.location.reload()
問題はnextPropsはまだ時に変更されていないということですURLが変更されているため、それ自体はまだチェックしています –