rtk-q createApi
One of rtk query’s api that help with keeping code that interact
with an backend api with a common baseUrl
.
|
|
The endpoints
property is where to define interactions with the backend api.
queries
are GET
requests and doesn’t take a body
attribute, unlike mutation
which
corresponds to writes to possible writes to the database like POST
and PATCH
.
|
|
createApi
generates hooks for the endpoints making it easier to get the state and
data from the responses from within react components. Sometimes, it’s necessary
to call these endpoints outside react components
such is the case
[dev_notes/react forms|here]