Michael Landis
Jul 24, 2023

There are other ways to do it -- the new React docs have a recommendation at https://react.dev/reference/react/useState#storing-information-from-previous-renders that should be usable -- but the use case remains valid today. Controlled versus uncontrolled inputs is the classic example.

But yes, pulling the state up makes sense for most circumstances. It's only a few cases where this becomes useful.

Michael Landis
Michael Landis

Written by Michael Landis

Front-end web developer, React enthusiast, vagabond.

No responses yet