4 ms·
I think the common, simpler way is to make the component itself (<AuthenticatedNav>) state-aware. So it always returns that component, but the component itself
by technobabbler 5y ago
I think the common, simpler way is to make the component itself (<AuthenticatedNav>) state-aware. So it always returns that component, but the component itself renders differently (`isLoggedIn && <NavBarSubComponent>`) depending on some upstream state passed as a prop or a shared context via a context provider.
If you return two different tags like the author did, React won't know how to properly inject that into the DOM. They are different elements, after all.