Skip to content

Instantly share code, notes, and snippets.

View premsai2030's full-sized avatar
🏠
Working from home

Prem Sai Vittal premsai2030

🏠
Working from home
View GitHub Profile
@premsai2030
premsai2030 / ApiInterface.js
Created August 6, 2022 09:24
Axios BoilerPlate with custom hook in React
import React, { useState, useEffect } from 'react';
import Axios from 'axios';
class ApiInterface {
constructor() {
this.axios = Axios.create({
baseURL: 'https://jsonplaceholder.typicode.com',
timeout: 3000,
});
this.methods = ['GET', 'POST', 'PATCH', 'PUT', 'DELETE'];