This is declarative! Your component class no longer cares how the state updates. It simply declares the type of update it desires.
Functional setState is the future of React
Justice Mba
2.7K50

Maybe I’m missing something, but how is this a “secret”? Many people may not know that you can pass a function into setState, but knowing that it’s not much of a cognitive leap (I’d say none at all) to realize you can pass a function defined anywhere.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.