DEV Community

Cover image for Selectors Family in Recoil for Statement Management — Nextjs
Next Dev
Next Dev

Posted on

Selectors Family in Recoil for Statement Management — Nextjs

Welcome friends. This blog post will teach you how to use the recoil selectors family for state management.

Video for those who understand Hindi:

How to use atoms in Recoil
How to use Selectors in Recoil

🤯Selectors vs SelectorFamily

When you use selectors, you **cannot **pass any parameters for doing some logical work. But when you use selectors Family, you can pass a param and can have a logic.

Example 👇

🤔Situation

Suppose, you have a to-do list website.

Example of the website:

**In simple words, **you enter the id of a todo that you want to edit. Then using the recoil selector family, we can get the data of **specific **todo by passing id as a param.

Then you have made the **atoms **for it 👇.


Index.tsx file 👇

This is your **selectors **file.

Now, let’s go to box.tsx file 👇

Still any doubt 🤔. You can join our discord channel👇
Join the Next Dev Discord Server!

Top comments (0)