How to fetch the new data in response to React Router change with Redux?

前端 未结 3 672
借酒劲吻你
借酒劲吻你 2020-12-12 16:24

I\'m using Redux, redux-router and reactjs.

I\'m trying to make an app where I fetch information on route change, so, I\'ve something like:



        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 16:46

    I've did this with custom binding on plain router onEnter/onLeave callback props like this:

    const store = configureStore()
    
    //then in router
    store.dispatch(myRouteEnterAction())} />
    

    It's a bit hacky but works, and I don't know better solution right now.

提交回复
热议问题