DEV Community

Discussion on: Protected Routes with React Function Components

Collapse
 
code4kongo profile image
Code4kongo

great article
i have tried to do the same thing in my application but i have a problem
the data that i passed to the ProtectedRoutes are undefined i don't know why

at first the date are present but once i click on the login button which must change the Auth state to true after an API call.
but once i receive the data they are lost in the ProtectedRoute and are set to undefined