Open littlehaker opened 4 years ago
This repo seems to be the correct usage of recoil.
recoil
The itemList atom only has ids rather than entities.
itemList
Many other tryouts use itemList to represent entities.
const todoItemsState = atom({ key: 'todoItemsState', default: [ { id: 1, text: 'Learn React', isComplete: true }, { id: 2, text: 'Learn Recoil', isComplete: true }, { id: 3, text: 'Write Todo App', isComplete: true }, ], });
In that case, the state change of each entity will create a new itemList instance, which leads to unnecessary renders.
Thank you :)
This repo seems to be the correct usage of
recoil
.The
itemList
atom only has ids rather than entities.Many other tryouts use
itemList
to represent entities.In that case, the state change of each entity will create a new
itemList
instance, which leads to unnecessary renders.