You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,10 @@ ReComponent comes with four different types of [effects](https://github.com/phil
99
99
100
100
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.
101
101
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.
0 commit comments