From 53f6bb709bc21382fe2682883b54fcbac3cee9ec Mon Sep 17 00:00:00 2001 From: Ruchita <70577616+Ruchita1010@users.noreply.github.com> Date: Thu, 30 Mar 2023 00:21:15 +0530 Subject: [PATCH] docs: fix typos in Component section of Legacy APIs (#5842) --- src/content/reference/react/Component.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/reference/react/Component.md b/src/content/reference/react/Component.md index 22025b89..25db032d 100644 --- a/src/content/reference/react/Component.md +++ b/src/content/reference/react/Component.md @@ -412,7 +412,7 @@ Run the [`rename-unsafe-lifecycles` codemod](https://github.com/reactjs/react-co If you define the `componentWillUnmount` method, React will call it before your component is removed *(unmounted)* from the screen. This is a common place to cancel data fetching or remove subscriptions. -The logic inside `componentWillUnmount` should "mirror" the logic inside [`componentDidMount`.](#componentdidmount) For example, if `componentDidMount` sets up a subscription, `componentWillUnmount` should clean up that subscription. If the cleanup logic your `componentWillUnmount` reads some props or state, you will usually also need to implement [`componentDidUpdate`](#componentdidupdate) to clean up resources (such as subscriptions) corresponding to the old props and state. +The logic inside `componentWillUnmount` should "mirror" the logic inside [`componentDidMount`.](#componentdidmount) For example, if `componentDidMount` sets up a subscription, `componentWillUnmount` should clean up that subscription. If the cleanup logic in your `componentWillUnmount` reads some props or state, you will usually also need to implement [`componentDidUpdate`](#componentdidupdate) to clean up resources (such as subscriptions) corresponding to the old props and state. ```js {20-22} class ChatRoom extends Component { @@ -739,8 +739,8 @@ React calls `shouldComponentUpdate` before rendering when new props or state are #### Parameters {/*shouldcomponentupdate-parameters*/} - `nextProps`: The next props that the component is about to render with. Compare `nextProps` to [`this.props`](#props) to determine what changed. -- `nextState`: The next props that the component is about to render with. Compare `nextState` to [`this.state`](#props) to determine what changed. -- `nextContext`: The next props that the component is about to render with. Compare `nextContext` to [`this.context`](#context) to determine what changed. Only available if you specify [`static contextType`](#static-contexttype) (modern) or [`static contextTypes`](#static-contexttypes) (legacy). +- `nextState`: The next state that the component is about to render with. Compare `nextState` to [`this.state`](#props) to determine what changed. +- `nextContext`: The next context that the component is about to render with. Compare `nextContext` to [`this.context`](#context) to determine what changed. Only available if you specify [`static contextType`](#static-contexttype) (modern) or [`static contextTypes`](#static-contexttypes) (legacy). #### Returns {/*shouldcomponentupdate-returns*/}