Skip to Content
React 16 Tooling
book

React 16 Tooling

by Adam Boduch, Christopher Pitt
April 2018
Intermediate to advanced content levelIntermediate to advanced
298 pages
6h 34m
English
Packt Publishing
Content preview from React 16 Tooling

The API

The API is the service that your React app interacts with in order to retrieve and manipulate data. When thinking about deploying production React applications, it's important to use the API as abstraction that not only represents one service, but potentially several microservices that your application interacts with.

With that said, let's look at the API functions that are used by your React components that make up Barely SMS:

export const login = body => fetch('/api/login', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), credentials: 'same-origin' }); export const logout = user => fetch('/api/logout', { method: 'post', credentials: 'same-origin' }); export const getUser = id => fetch(`/api/user/${id}`, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro React 16

Pro React 16

Adam Freeman

Publisher Resources

ISBN: 9781788835015Supplemental Content