Skip to content

Instantly share code, notes, and snippets.

@stenin-nikita
Created September 23, 2020 07:45
Show Gist options
  • Save stenin-nikita/db0b3e153e5db9ba471644ac621c3ad5 to your computer and use it in GitHub Desktop.
Save stenin-nikita/db0b3e153e5db9ba471644ac621c3ad5 to your computer and use it in GitHub Desktop.
const paths = declareAtom({}, on => [
on(itemsAtom, (state, items) => {
const ims = values(items);
const paths = {};
for (const id of ims) {
paths[id] = getPathForItem(id, items);
}
return paths;
})
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment