Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

organize api calls react native folder

import ky from "ky";
const apiClient = ky.create({
  prefixUrl: API_URL, // <- ENV variable
  headers: {
    ...
  }
  hooks: {
    beforeRequest: (request) => {...}
    afterResponse: (response) => {...}
});
const { get, post, put, delete: destroy } = apiClient;
export { get, post, put, destroy };
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #organize #api #calls #react #native #folder
ADD COMMENT
Topic
Name
9+1 =