Hello-World-Software-Studios / calculator

Carpenter's tool for wall layout
0 stars 1 forks source link

Stretch Goal: Make a reusable hook for grabbing/posting data #57

Closed ecumene closed 3 years ago

ecumene commented 3 years ago
const {data, loading, error} = useAPI(`/projects/${id}`) // Returns an object
const makeNewProject = usePostAPI('/projects/'); // Returns a function

makeNewProject({ name: 'Hello world' });
JPM709 commented 3 years ago

useAPI working for fetching username, and usePostAPI works for posting to projects. usePostAPI was a bit confusing, but I get the idea now. once implemented with post walls, I should have a better grasp.