DEV Community

Discussion on: How to pass and access data from one route to another with useLocation, useNavigate, useHistory hooks.

Collapse
 
abhishekm2106 profile image
Abhishek Mohanty

navigate("/profile-two", { state: data });

so here if I want to access the state in all the subroutes of "/profile-two", how can I do that?

like I want to access the state when I am on "/profile-two?activeTab=1".

Collapse
 
oussamabouyahia profile image
Oussama Bouyahia • Edited

you talk about another subject , when you want to access a state from anywhere you have to implement a state management (redux for example or simply use useContext hook).
the concept here is only how to send state from a route to another.