Skip to content
Advertisement

Resetting redux states on url change

I have a project that redux working on. But when I click on a <Link> component or click on to the “previous page” button on chrome, redux keeps the states I changed before. I tried the LOCATION_CHANGE action from connected-react-router and use it in reducer but it does not seem to work.

reducer:

JavaScript

Advertisement

Answer

You can try something like this :

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement