next.js
1f55ba35 - Change `usePathname` to return `string | null` (#42380)

Commit
3 years ago
Change `usePathname` to return `string | null` (#42380) This changes the API of `usePathname` to return `string | null` to support hybrid use-cases where the pathname is unknown at build time (during automatic static optimization and when fallback is set true with dynamic parameters in the pathname). This supports a cleaner DX experience for those moving from `pages/` to `app/` so they can begin to use `usePathname` in components that are shared across them.
Author
Parents
Loading