mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Feat(Contacts): Mapping contacts from DB
This commit is contained in:
1 parent
9e8442491b
commit
3a213ea308
9 files changed
+110
-83
No files matched your search
@@ -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 };
|
||||
//};
|
||||
Reference in new issue
Block a user