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
kapa.ai
kapa.ai2w ago
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?
blair
blair2w ago
What's the link to the frontend routing issue? (edit: found it) Ah, after some further reading it seems you guys use react-router under the hood and useLocation() works. Perhaps this could be documented? Either way, thanks for all that you do!
Want results from more Discord servers?
Add your server