Skip to content

Commit 9567374

Browse files
vovacodesphilipp-spiess
authored andcommitted
Add "dont use this.send in componentWillUnmount" section to README (#15)
Just wanted to clarify a confusing moment: "shall I always call side-effects through sending an action?" React [docs](https://reactjs.org/docs/react-component.html#componentwillunmount) say that you should never call `setState` in `componentWillUnmount` and `this.send` eventually calls `setState`, so I believe we should make it clear that we shouldn't call `this.send` in `componentWillUnmount` either. What do you think?
1 parent dcba695 commit 9567374

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ ReComponent comes with four different types of [effects](https://github.com/phil
9999

100100
By intelligently using any of the four types above, it is possible to transition between states in one place and without the need to use `setState()` manually. This drastically simplifies our mental model since changes must always go through the reducer first.
101101

102+
**NOTE!**
103+
You should NEVER call `this.send` or any sender in **`componentWillUnmount`**.
104+
If you need to execute a side-effect in **`componentWillUnmount`** (e.g. clear a timer) call that side-effect directly.
105+
102106
## FAQ
103107

104108
### Advantages Over `setState`

0 commit comments

Comments
 (0)