you can use the functional way of setState by passing a transaction function (state: State) =&gt; State . This allows for typed, immutable updates since the function gets passed a copy of the state.<p>If you need an object (say to use it in something like Redux), you have to write a wrapper like so: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;ebi&#x2F;d186c4297c84d562aeae" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;ebi&#x2F;d186c4297c84d562aeae</a>