reactjsreact-router

React router v6 doesn't support <Prompt /> or usePrompt


Migrating a codebase to react-router v6 specifically v6.2.1 and running into some issues when trying to use <Prompt /> component or usePrompt, turns out they are not available in this version of react-router. Or am I wrong? If anyone have run in to the same issue or if you know a way around this issue, your help would be appreciated.


Solution

  • Prompt is currently not supported in v6

    You will have to create your own component that performs the check and displays the prompt.