Skip to content

[Docs]: useBlocker usage #12628

@flaff

Description

@flaff

Describe what's incorrect/missing in the documentation

Hello 👋

Using useBlocker causes "Error: useBlocker must be used within a data router." error, but there is no DataRouter or useBlocker in docs. How should it be used?

Activity

changed the title [-][Docs]: useBlocker usage[/-] [+][Docs]: `useBlocker` usage[/+] on Dec 23, 2024
akoskm

akoskm commented on Jan 29, 2025

@akoskm

If this error appears inside of a test, make sure you wrap your component with the stub router: https://reactrouter.com/start/framework/testing#testing

einarq

einarq commented on Jan 31, 2025

@einarq
marcellobarile

marcellobarile commented on Mar 24, 2025

@marcellobarile

On top of that, this table here looks misleading as it has green ticks for all the modes about useBlocker, while (if I got it correctly) that's not true.

brookslybrand

brookslybrand commented on Jun 13, 2025

@brookslybrand
Contributor

Thanks @flaff for raising this!

We do now have a useBlocker doc

@einarq I've added some of the context in those docs that were missing in #13803

@marcellobarile the table seems to be corrected now. Thanks for pointing this out though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @einarq@marcellobarile@akoskm@flaff@brookslybrand

      Issue actions

        [Docs]: `useBlocker` usage · Issue #12628 · remix-run/react-router