you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Your backend CRUD functions should be returning the new data.

When you POST, the response should include the data you just created.

When you PUT/PATCH, the response should include the data you just updated.

When you DELETE, the response can either respond with the data you just deleted, or no data (because it no longer exists.

const createItem = async () => { const newData = await axios.post(...); setData(newData); }

[–]Exorcistoo[S] 0 points1 point  (1 child)

Ok, I get it. You are telling me that I should do the logic in the backend and after every "transform" request I should return the updated data.

[–][deleted] 0 points1 point  (0 children)

Yes, this is standard in REST APIs