Is it possible to use ES6\'s Set
data structure in React?
For example, if I have a checklist composed of distinct items, and I\'d like to maintain each item
state
is just a common object, you can hold what ever you want in it.
You can overwrite the shouldComponentUpdate
lifecycle method to implement it yourself. You can use you own logic to figure out if the component needs to update or not.
You don't even need to nest your set, you can just set it directly as the state
:
this.state = new Set();