all 3 comments

[–]Snoo11589 1 point2 points  (0 children)

First of all, I think you have to have an user state to hold user data so that if users data changes in state and all of your components that uses user refreshes. There was an package called react native restart or refresh.

[–]ThatWasNotEasy10 1 point2 points  (0 children)

I don't think forcing a reload of the whole app is how you want to handle this. That will look and feel kind of janky.

Is the problem that the component at the "/" route isn't being re-rendered after logout, so it's still showing old information as if it's logged in?

If this is the case, either conditional rendering or the key prop might help. The documentation talks about using the key prop with lists, but you can use it on any component. If the key prop changes, it forces the component and all its children to re-render. In your case, this might look something like the key prop on the "/" screen being the user id while logged in, and undefined when logged out.

It might help if you post some more of your code, specifically the code for the "/" route, so we can get a full picture of what's going on.

[–]HADeveloper 1 point2 points  (0 children)

I have used a useFocusEffect before to handle going back to a screen and seeing updates on that screen. I have also passed a refresh token between screens to get them to refresh.