Skip to content
Discussion options

You must be logged in to vote

I probably recommend using ErrorBoundary if it fits your use case since it handles unmounting of children. It uses onError internally but the benefit of ErrorBoundary is it ensures children are all resolved up to that point. With onError it is possible for children contexts to get passed out of the creator upwards and escape it. onError is the lower level primitive and is ok generally higher up in the render tree for logging things but ErrorBoundary is more suited for managing the view. I mostly provide onError in case someone wishes to implement their own ErrorBoundary different than I have created.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zhaoyao91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants