I want to clear user and do logout in React Native using useContext
, useReducer
, and useMemo
.
My App (AuthContext) has Users Screen (UserContext) in it.
UserContext has clearUsers()
within useMemo
AuthContext has logout()
within useMemo
UserContext's content is cleared if I do:
clearUsers();
But when I add logout after or before clearUsers, the userContext content is keep coming back after relogin.
clearUsers();
logout();
Anyone experienced this? Please advice.
Turned out that circular import reference casued this. After put context as top reference fixed this issue.