Hi guys 👋 ,
I'm struggling with being able to show/hide elements based on the user auth api response. A simple example is I'd like to show the log in button if the user is not authenticated, and hide it if they are (and show the log out button).
The current setup is I have an auth wrapper that hold the API request, and sets variables for if the request was successfull "auth-success". But I'm stuck with being able to show/hide other elements on the page (and in other components on the page like the nav bar) based on this. I believe this is because the data and variables are encapsulated within the component.
This is obviously a common and basic feature but I'm stumped.
Attached an image of the current structure. There are elements I'd like to show/hide within the header component also. This structure might be completely wrong 😂
Any help is appreciated.
TIA 🙏