1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

added notes sidebar

This commit is contained in:
Fedor Katurov 2022-08-03 16:16:34 +07:00
parent fe3db608d6
commit cedf0adcfa
14 changed files with 376 additions and 153 deletions

View file

@ -0,0 +1,19 @@
import { createContext, FC, useContext } from "react";
import { useNotes } from "~/hooks/notes/useNotes";
const NoteContext = createContext<ReturnType<typeof useNotes>>({
notes: [],
hasMore: false,
loadMore: async () => Promise.resolve(undefined),
isLoading: false,
submit: () => Promise.resolve(),
});
export const NoteProvider: FC = ({ children }) => {
const notes = useNotes("");
return <NoteContext.Provider value={notes}>{children}</NoteContext.Provider>;
};
export const useNotesContext = () => useContext(NoteContext);