Skip to content

ErrorBoundary documentation is not clear and it's lacky #3463

Open
@danielo515

Description

@danielo515

Hello,
I read the documentation about Error boundaries several times and I find them to be very short in terms of detail. I get much more information from third party gists and more detailed than I get from the official documentation.

First, the distinction between componentDidCatch and getDerivedStateFromError is unclear. Docs says that getDerivedStateFromError is for creating the required state when an error happens, but it only gets the error, not the error info, which is a key piece of information.
Then it is also mentioned that componentDidCatch is useful to report to a remote error handling service, which makes me thing that I should not do anything else there. However, on the linked gist of @gaearon the getDerivedStateFromError method is completely ignored and the componentDidCatch method is used for all the state construction (which makes much more sense given the extra info it gets).

I think docs should make a clear distinction about what each method is for exactly, and not just a short and non conclusive sentence.

I also miss more information about what each of the provided error informations contains. What is error info? What it contains? It is not even mentioned on the docs at all, which leaves you guessing what to expect from both error and errorInfo. React docs should be the main source of information, and not third party gists, libraries and blog-posts.

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: exampleusually a request to add an example/lib/app

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions