T
TanStack2y ago
exotic-emerald

Custom blocker component

Hey, I saw on the docs that it is possible to use custom UI for useBlocker, but I’m not sure how this would be implemented. Does anyone have an example?
3 Replies
exotic-emerald
exotic-emerald2y ago
There's an open PR exploring this pattern https://github.com/TanStack/router/pull/1649 but for now you have to roll your own hook, as the current useBlocker doesn't handle custom UI
GitHub
feat(react-router): improve the blocker functionality for use with ...
We were talking about this on discord, trying to find a handy way to display custom UI when blocking navigation. I adapted a bit @freshgiammi's first draft and expanded it to the Blocker compon...
exotic-emerald
exotic-emeraldOP2y ago
That’ll help a ton, thanks!
fascinating-indigo
fascinating-indigo2y ago
please also comment on the PR if you have feedback

Did you find this page helpful?