Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 625 Bytes

File metadata and controls

31 lines (22 loc) · 625 Bytes

Server-Access

Fetch

  • Using "native" fetch with babel-polyfill
  • "Register" the polyfill via require, import or in webpack.config.js
npm install babel-polyfill --save-dev
module.exports = {
  entry: ['babel-polyfill', './src/app.js'],
};
fetch('http://localhost:8080/posts')
  .then(response => response.json)
  .then(data => this.setState({ content: data.content }))
  .catch(error => this.setState({ error: error.message }));

Redux-Thunk

  • Async dispatching Redux Action-Creator

Example