Closed xaphod closed 3 years ago
@xaphod if you are in a reducer, you would only have access to the state of that reducer, not the whole store state.
It seems like you would have to extract dynamic1
and dynamic2
before it gets to the reducer. That way you can add them to the action data and access it in the reducer. There are multiple ways of doing this.
Let me know if that's possible
Thanks for the quick reply. This project isn't using redux/actions to navigate, so i'm not sure where/when we would do that.
@xaphod It would have to be done where you dispatch the action. Alternatively, you could handle the LOCATION_CHANGE
action the library uses in that reducer, and extract dynamic1
and dynamic2
from the payload's location object.
OK thank you
Hi @danielr18 thanks for making this.
I have a problem where i'm in a reducer, and the current path could be like
/static1/static2/dynamic1/dynamic2
, or it could be/dynamic1/dynamic2
, and I need to extract & usedynamic1
anddynamic2
. I want to find a solution that is agnostic to the values of staticN.I would have used
useRouter()
and examined thequery
, but i'm in a reducer so I can't. I was hoping that usingconnected-next-router
to put the router's state into redux would let me do this, but I cannot see how. Any ideas? (I've gotten to the point where I can see the router's state in redux)