vendredi 22 janvier 2021

Is it possible to hide a parent component from child component in React.js?

As shown in my ugly looking Flowchart, I want to hide the Header component if Main component renders the Login component. But if the Main component renders the Home component, I want to display the Header component. The Main.js has a conditional operator that returns either Home component or Login component.

Putting the Header Component in Home itself will not solve the problem as I have to add much more pages and adding a Header component in every page doesn't seem efficient.

Flowchart




Aucun commentaire:

Enregistrer un commentaire