Rendering components in reactjs

I have 4 component in app.jsx <Component 1 /> <Component 2 /> <Component 3/> <Component 4/> So I want to render component 1 all the time that is for ( component 2,3) So when I'm in component 4 , i don't want to render component 1
2 Replies
missymae
missymae4mo ago
useState variable and conditional rendering, for example
const [currentView,setCurrentView] = useState(1)
return (
<>
{currentView !== 4 && <Component1/>}
...
</>
const [currentView,setCurrentView] = useState(1)
return (
<>
{currentView !== 4 && <Component1/>}
...
</>
for more complex designs you might use nested layouts
vic
vicOP4mo ago
Is nested layouts and nested routes are same topics
Want results from more Discord servers?
Add your server