From 3bdf46ca2918ef57b9ade3d7962c8e77912d87a5 Mon Sep 17 00:00:00 2001 From: Daniel Lo Nigro Date: Thu, 27 Jul 2017 02:23:36 -0700 Subject: [PATCH] Replace "children (and grandchildren)" with "descendants" (#10297) --- _posts/2017-07-26-error-handling-in-react-16.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2017-07-26-error-handling-in-react-16.md b/_posts/2017-07-26-error-handling-in-react-16.md index f892f5b1..739eba36 100644 --- a/_posts/2017-07-26-error-handling-in-react-16.md +++ b/_posts/2017-07-26-error-handling-in-react-16.md @@ -15,7 +15,7 @@ In the past, JavaScript errors inside components used to corrupt React’s inter A JavaScript error in a part of the UI shouldn’t break the whole app. To solve this problem for React users, React 16 introduces a new concept of an “error boundary”. -Error boundaries are React components that **catch JavaScript errors in their children (and grandchildren), log those errors, and display a fallback UI** instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them. +Error boundaries are React components that **catch JavaScript errors in their descendants, log those errors, and display a fallback UI** instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them. A class component becomes an error boundary if it defines a new lifecycle method called `componentDidCatch(error, info)`: @@ -97,4 +97,4 @@ Error boundaries preserve the declarative nature of React, and behave as you wou ## Naming Changes from React 15 -React 15 included a very limited support for error boundaries under a different method name: `unstable_handleError`. This method no longer works, and you will need to change it to `componentDidCatch` in your code starting from the first 16 beta release. \ No newline at end of file +React 15 included a very limited support for error boundaries under a different method name: `unstable_handleError`. This method no longer works, and you will need to change it to `componentDidCatch` in your code starting from the first 16 beta release.