paint-brush
Reactjs and Ajaxby@audruis
1,691 reads
1,691 reads

Reactjs and Ajax

by AudrusOctober 26th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

React is a library for a View part. It works with DOM. I work with React/Redux, because Redux gives good help for handling with states. When developers work with a View part, them need to get data from server. Ajax is technology for Javascript and server data exchange. React haven’t tools for Ajax.

Company Mentioned

Mention Thumbnail
featured image - Reactjs and Ajax
Audrus HackerNoon profile picture

React is a library for a View part. It works with DOM. I work with React/Redux, because Redux gives good help for handling with states. When developers work with a View part, them need to get data from server. Ajax is technology for Javascript and server data exchange. React haven’t tools for Ajax.

So… We can work with vanilla Ajax, or we can download Ajax module. For React are two better Ajax modules: Axios and Fetch. I work with Fetch. It is very simple and has polyfill for older browsers.

I wrote ir previous article about React and Redux. When we work with React/Redux and Fetch (or Axios) we have to mutate actions.

In example i call dispatch in action file. Fetch sends data to server and gets response. Promise calls dispatch and sends data to receivePermission function. If we work with Fetch we have to know — Ajax is asynchronous technology and need work differently.