Reputation: 229
Here is my Sandbox code https://codesandbox.io/s/wispy-glitter-spgch?file=/src what i am trying to do is on click of LOGIN Button trying to rendering the Dashboard page the url does go to the path '/dashboard'but do not render anything I am not able to find the error I have done routing in a component and passed that component inside of Context API
On page refresh i.e. in '/dashboard' dashboard section it again goes to login part how to maintain this with state
Upvotes: 1
Views: 42
Reputation: 65
Use exact
parameter in protected route like this:
<ProtectedRoute
path="/dashboard"
exact
auth={authState.isAuthenticated}
component={Dashboard}
/>
Upvotes: 1