Feat(Contacts): Mapping contacts from DB

This commit is contained in:
chip committed 2020-08-27 23:40:37 +02:00
1 parent 9e8442491b
commit 3a213ea308
9 files changed
+110 -83

No files matched your search

+25 -19
View File
@@ -1,22 +1,28 @@
import { useRecoilState, atom } from "recoil";
const contactListState = atom({
key: "contactList",
default: [
{
id: 0,
display: "Test Contact",
phoneNumber: "000-1111",
},
{
id: 1,
display: "Test Contact 2",
phoneNumber: "000-1112",
},
],
});
import { useRecoilValue } from "recoil";
import { contactsState } from "./state";
export const useContacts = () => {
const [contactList, setContactList] = useRecoilState(contactListState);
return { contactList, setContactList };
const contacts = useRecoilValue(contactsState.contacts);
return { contacts };
};
//const contactListState = atom({
// key: "contactList",
// default: [
// {
// id: 0,
// display: "Test Contact",
// phoneNumber: "000-1111",
// },
// {
// id: 1,
// display: "Test Contact 2",
// phoneNumber: "000-1112",
// },
// ],
//});
//
//export const useContacts = () => {
// const [contactList, setContactList] = useRecoilState//(contactListState);
// return { contactList, setContactList };
//};