Skip to content

Instantly share code, notes, and snippets.

View lndgalante's full-sized avatar

Leonardo Galante lndgalante

View GitHub Profile
@lndgalante
lndgalante / createCrudHooks.js
Created December 1, 2020 01:24 — forked from tannerlinsley/createCrudHooks.js
A naive, but efficient starter to generate crud hooks for React Query
export default function createCrudHooks({
baseKey,
indexFn,
singleFn,
createFn,
updateFn,
deleteFn,
}) {
const useIndex = (config) => useQuery([baseKey], indexFn, config)
const useSingle = (id, config) =>