Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30e16e4

Browse files
committed
Document isMounted
Text from @petehunt
1 parent 7c4c0cd commit 30e16e4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/docs/ref-02-component-api.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,12 @@ If your `render()` method reads from something other than `this.props` or `this.
107107
Calling `forceUpdate()` will cause `render()` to be called on the component and its children, but React will still only update the DOM if the markup changes.
108108

109109
Normally you should try to avoid all uses of `forceUpdate()` and only read from `this.props` and `this.state` in `render()`. This makes your application much simpler and more efficient.
110+
111+
112+
### isMounted()
113+
114+
```javascript
115+
bool isMounted()
116+
```
117+
118+
`isMounted()` returns true if the component is rendered into the DOM, false otherwise. You can use this method to guard asynchronous calls to `setState()` or `forceUpdate()`.

0 commit comments

Comments
 (0)