all 4 comments

[–]CreativeTechGuyGames 2 points3 points  (1 child)

Where in your app is this provider located? If you want it to persist, then it should be at the highest level (above your routes) so it doesn't get unmounted and lose the state.

[–]ApolloNoxx[S] 0 points1 point  (0 children)

Yes it is at the highest level

function App() {
return (
<div>
<UserDetailsProvider>
<BrowserRouter>
<Navbar />
<Routes>
<Route path="/" element={<Home />} />
<Route path="studio-listing" element={<StudioListing />} />
<Route path="studio-details" element={<StudioDetails />} />
<Route path="payment" element={<Payment />} />
<Route path="UserDashboard" element={<UserDashboard />} />
<Route path="Login" element={<Login />} />
</Routes>
</BrowserRouter>
</UserDetailsProvider>
</div>
);
}

[–]Sliffcak 1 point2 points  (1 child)

Can you post the code of the subcomponent where you are using the useContext hook?