From 464e470441287572cfda8d95484f781236b9db35 Mon Sep 17 00:00:00 2001 From: piotrruss Date: Mon, 9 Aug 2021 21:36:03 +0200 Subject: init commit --- apps/Notes/hooks/useNotes.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 apps/Notes/hooks/useNotes.js (limited to 'apps/Notes/hooks/useNotes.js') diff --git a/apps/Notes/hooks/useNotes.js b/apps/Notes/hooks/useNotes.js new file mode 100644 index 0000000..9d79034 --- /dev/null +++ b/apps/Notes/hooks/useNotes.js @@ -0,0 +1,8 @@ +import useSWR from 'swr' +import fetchJson from 'lib/fetchJson' + +export default function useNotes(){ + const { data: notes, error, mutate: mutateNotes } = useSWR('/api/notes') + + return {notes, mutateNotes, error} +} -- cgit v1.2.3