DEV Community

Joar Bølstad
Joar Bølstad

Posted on

React context/hooks design inspiration for CRUD w/backend?

I'm two months into the adventure that is React. So far I've followed some tutorials, worked on a learning project, and basically gotten to the point that I've decided I need to refactor my app to get a clean design.

One thing that has bothered me in particular is that my API backend is fairly well organised, yet I am duplicating code all over the place in the frontend.

Thus, my attention got drawn to the whole context/hooks feature set of React. It seems a great fit for my needs, although I can't really know before I've tested it thoroughly. So I've started to refactor my app to use context and refactored my class components to functional components. So far so good, especially data fetching (GET) is pretty ok.

Long story short: I'd like to see one or more tutorials or articles on how to communicate with the backend from a centralised datastore or similar. What are some great patterns for handling PUT, POST, and DELETE actions for my app?

Top comments (0)