LeetCode-OpenSource/ayanami

No way to use getDerivedStateFromProps if state is in Ayanami

Luminqi opened this issue · 0 comments

When I trying to update state in render just like using getDerivedStateFromProps, the initial Ayanami state cannot be ignored. This might not be a problem, but the behavior is different with just storing state in component.

The example:
state in ayanami: https://codesandbox.io/s/ayanamiminimal-example-zw3fi?fontsize=14
state in component: https://codesandbox.io/s/test-getderivedstatefromprops-lricw?fontsize=14