NextJS usePathname equivalent
Gday devs,
I'm currently using
client.rootComponent
in a similar fashion to NextJS's layout.tsx
however was there an alternative to usePathname()
? Or do I need to patch together my own?
Obviously window.location.pathname
exists but it won't trigger a re-render upon navigation. Couldn't find anything in gh issues or on the docs, so reaching out here. Cheers!2 Replies
Hi @blair. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided don't mention a direct equivalent to NextJS's
usePathname()
in Wasp. However, there's an open issue on GitHub discussing the improvement of frontend routing in Wasp, which includes ideas like type-safe routes and a Link
component. You might find updates or relevant discussions there in the future.
For now, you might want to check the Wasp CLI Reference (https://wasp-lang.dev/docs/general/cli) and API Reference (https://wasp-lang.dev/docs/data-model/backends#api-reference) for more information.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @blair, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?