Skip to content

Instantly share code, notes, and snippets.

View mkrishnan-codes's full-sized avatar
:atom:

Manu Krishnan mkrishnan-codes

:atom:
View GitHub Profile
@mkrishnan-codes
mkrishnan-codes / BookContext.js
Created February 17, 2020 09:04 — forked from kjmczk/BookContext.js
Fetching API data with React Hooks - Build a React App using Basic Hooks
const BookContextProvider = ({ children }) => {
// ...
// add
const getBooks = async () => {
const res = await fetch(
'https://jsonplaceholder.typicode.com/posts?_start=2&_limit=5'
);
const data = await res.json();