Choose the Right Hook for Your Recoil State

InstructorYoni Weisbrod

Share this video with your friends

Send Tweet

Recoil offers several hooks to use for consuming state in React, and this lesson looks at how to choose which hook to use, and what happens when you don't use the right hook (hint: extra renders).

The three basic RecoilJS hooks are:

  1. useRecoilState, which is great for reading and writing state,
  2. useRecoilValue, ideal for reading state, and
  3. useSetRecoilState, the primary candidate when you just need to write state.