mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
This is how React recommend dealing with derived state that needs to be reset: https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html The problem is that the new turn will give the component new props, but new props will not cause the state to be reset. We can either do that manually (which React recommends only for the cases where it is absolutely necessary: https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops), or by forcing the component to be replaced by using a key. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2388.