Description
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