teslamotors / informed

A lightweight framework and utility for building powerful forms in React applications
https://teslamotors.github.io/informed
MIT License
956 stars 174 forks source link

Introduce the useFormStateSelector hook #413

Closed robin-ambachtsheer closed 2 years ago

robin-ambachtsheer commented 2 years ago

This hook is all about preventing unnecessary re-renders in your React components.

const someField = useFormStateSelector((formState) => formState.values.someField);

return someField; // re-renders when formState.values.someField is changed