This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
Question: change array from atom while looping through it (expecting to process new array) #1772
Unanswered
artem-tarasenko
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks, this might be a bit too specific question, but I just get a feeling that Recoil might help me in solving a problem. I will try express it with a classy Todo app.
So, as Todo usually works, it should have the following:
Array{ title: string, isDone: boolean }
Lets extend that a little bit:
What I have for now is now quite working, whenever I pass an array (from atom state) to utility fn that has
for await of
loop it process it fully, obviously not getting new array if user deleted 1 item, as a result, whole array passed to a fn is processed including deleted todo. I also tried creating utility with recursion instead of the loop but no luck there as well.I checked the course by Jacques Blom, great content but unfortunately it doesn't cover all hooks and util from Recoil. So, I'm somewhat in the loss of a direction on where should I look to get that working.
My last unchecked thought was to use TodosState=AtomFamily({}) and TodosSyncState=SelectorFamily({}), but event before testing I'm expecting some problems:
I would appreciate any tips and ideas of how to approach such case, thanks.
Beta Was this translation helpful? Give feedback.
All reactions