Fix set state calls
This branch consists of several changes to this.setState calls. This could allow us to use PureComponent instead of Component which could result in improved performance.
Transformations include:
-
this.setState(prevState => {return {...}})➡ this.setState(prevState => ({...})) - Better ts types for
setStaterelated methods (usingkeyof Somethinginstead ofstring) - increases type safety and prevents typos. - Using functional logic in react
setStateclosures which is preferred in general (I would suggesting updatingtypescriptso thatsetStatecallbacks can benefit of optional chaining i.e.prevState?.sections.map(a => ...)instead ofprevState.sections ? prevState.sections.map(a => ...) : undefined) - Removing unused parameters