Cleaning up setter function that is a function
So I need to set my state to this:
() => {}. However, if you supply () => {} to react in a setter, like so: setState(() => {}) it will instead return an empty object, since React uses that syntax to use the previous state.
Is there a better way to do this than this: setState(() => () => {})?2 Replies
My title is pretty garbage, so I apologize lol
no
is the best way lol
you can make it more obvious though