Naming API services when using React Query #
📁 Folder: /services/{path}
(services can be whatever you want but services is
vague enough).
GET
is implied.
use{ Create | Delete | Update}{Noun(id) | Nouns}.ts
API Path | Doing | Hook Name |
---|---|---|
/users | GET all users | useUsers() |
/users/{email} | GET user by email | useUser(email:string) |
/users/{email} | PUT update user | useUpdateUser(user:User) |