Skip to content

Instantly share code, notes, and snippets.

@GunaShekar02
Last active June 9, 2020 20:20
Show Gist options
  • Save GunaShekar02/4cb32e13f641f411ce4c0d34f88dd499 to your computer and use it in GitHub Desktop.
Save GunaShekar02/4cb32e13f641f411ce4c0d34f88dd499 to your computer and use it in GitHub Desktop.
import { selector } from "recoil";
import { currentContactState } from "./atoms";
import { getContacts, getDetails } from "../data";
export const contactsList = selector({
key: "contactsList",
get: async () => {
const response = await getContacts();
return response;
},
});
export const currentContactDetails = selector({
key: "currentContactDetails",
get: async ({ get }) => {
const response = await getDetails(get(currentContactState));
return response;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment