Last active
June 9, 2020 20:20
-
-
Save GunaShekar02/4cb32e13f641f411ce4c0d34f88dd499 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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