From 25cc703d1f23f1782ff96c5c7882a806f8741ec4 Mon Sep 17 00:00:00 2001 From: kamlesh tajpuri Date: Sun, 30 Aug 2020 23:01:45 +0530 Subject: [PATCH] =?UTF-8?q?Updating=20the=20docs=20to=20reflect=20the=20fa?= =?UTF-8?q?ct=20that=20React.memo=20can=20be=20used=20wit=E2=80=A6=20(#315?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updating the docs to reflect the fact that React.memo can be used with both class and functional components * removed misleading para --- content/docs/reference-react.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/reference-react.md b/content/docs/reference-react.md index e8b3a4fa..65c513e9 100644 --- a/content/docs/reference-react.md +++ b/content/docs/reference-react.md @@ -124,9 +124,9 @@ const MyComponent = React.memo(function MyComponent(props) { }); ``` -`React.memo` is a [higher order component](/docs/higher-order-components.html). It's similar to [`React.PureComponent`](#reactpurecomponent) but for function components instead of classes. +`React.memo` is a [higher order component](/docs/higher-order-components.html). -If your function component renders the same result given the same props, you can wrap it in a call to `React.memo` for a performance boost in some cases by memoizing the result. This means that React will skip rendering the component, and reuse the last rendered result. +If your component renders the same result given the same props, you can wrap it in a call to `React.memo` for a performance boost in some cases by memoizing the result. This means that React will skip rendering the component, and reuse the last rendered result. `React.memo` only checks for prop changes. If your function component wrapped in `React.memo` has a [`useState`](/docs/hooks-state.html) or [`useContext`](/docs/hooks-reference.html#usecontext) Hook in its implementation, it will still rerender when state or context change.