React JS - How to hide parent component content when child is rendering?

Viewed 51

I have some nested components and I use outlet to render the children's content, but the page is getting crowded and I want to hide the parent content after the child is rendered . How can I do that?

 let params = useParams();
<div>
!params.id && (<div>
*render your contents here* </div>)
<Outlet />
</div>

This should work , but where I have to put the code , in the parent component or in the child ?

0 Answers
Related