Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const filteredTodoListState = selector({
key: 'filteredTodoListState',
get: ({get}) => {
const filter = get(todoListFilterState);
const list = get(todoListState);
switch (filter) {
case 'completed':
return list.filter((item) => item.isCompleted);
case 'uncompleted':
return list.filter((item) => !item.isCompleted);
default: // all
return list;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.