is there a way to conditionally render components based on URL in next.js?
Edit:
as if now, I'm doing this:
const router = useRouter();
return (
<>
<SomeComponent />
{router.pathname === "/somePath" && <RenderThis />}
</>
)
I'm wondering if there's a better/cleaner way to this conditional render? like...
<>
<SomeComponent />
<Route path="/additionalUrl" component={RenderThis} />
</>
//or
<>
<SomeComponent />
<Route path="/additionalUrl">
<RenderThis />
</Route>
</>