3 ms·
The article doesn't really make any kind of argument that is about React itself. React doesn't require immutability of state, though in most cases it is a very
by fabian2k 4y ago
The article doesn't really make any kind of argument that is about React itself. React doesn't require immutability of state, though in most cases it is a very good idea to have immutable state as it'll allow you to easily avoid rerendering by comparing objects. And even with immutable state, I'm pretty sure that isn't the bottleneck in most slow React applications. The author didn't measure anything, but recreating a small ToDo array on removing an element is unlikely to cause any performance issues. And the data structure seems fundamentally flawed anyway, if you have two ToDos with the same text it would remove both. In a real case you'd access them by index/id anyway
Interfacing with imperative libraries in React can be a bit daunting at first. But that is kind of an unavoidable problem unless you want to make everything imperative again.