Skip to content

Commit b24caba

Browse files
authored
Code the null and undefined values (#3203)
1 parent 657658a commit b24caba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/docs/reference-react-component.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Currently, if `shouldComponentUpdate()` returns `false`, then [`UNSAFE_component
274274
static getDerivedStateFromProps(props, state)
275275
```
276276

277-
`getDerivedStateFromProps` is invoked right before calling the render method, both on the initial mount and on subsequent updates. It should return an object to update the state, or null to update nothing.
277+
`getDerivedStateFromProps` is invoked right before calling the render method, both on the initial mount and on subsequent updates. It should return an object to update the state, or `null` to update nothing.
278278

279279
This method exists for [rare use cases](/blog/2018/06/07/you-probably-dont-need-derived-state.html#when-to-use-derived-state) where the state depends on changes in props over time. For example, it might be handy for implementing a `<Transition>` component that compares its previous and next children to decide which of them to animate in and out.
280280

@@ -587,7 +587,7 @@ Normally you should try to avoid all uses of `forceUpdate()` and only read from
587587

588588
### `defaultProps` {#defaultprops}
589589

590-
`defaultProps` can be defined as a property on the component class itself, to set the default props for the class. This is used for undefined props, but not for null props. For example:
590+
`defaultProps` can be defined as a property on the component class itself, to set the default props for the class. This is used for `undefined` props, but not for `null` props. For example:
591591

592592
```js
593593
class CustomButton extends React.Component {
@@ -607,7 +607,7 @@ If `props.color` is not provided, it will be set by default to `'blue'`:
607607
}
608608
```
609609

610-
If `props.color` is set to null, it will remain null:
610+
If `props.color` is set to `null`, it will remain `null`:
611611

612612
```js
613613
render() {

0 commit comments

Comments
 (0)