Creating a demo with Redux and asynchronous

Now the time has come to test everything out. What we are interested in here is ensuring that our store state behaves the way we want it to. We want the store to reflect the fact that we are loading the data, receiving the data, and if there is an error, that should be reflected as well. Let's start out by mimicking an AJAX call:

const { fetchBookLoading, fetchBookSuccess, fetchBookError } = require('./book-actions');const { dispatch, getState } = require('./redux');function fetchBook() {  return new Promise(resolve => {    setTimeout(() => {      resolve({ title: 'A new hope  - the book' });    }, 1000);  })}

As our next order of business, let's set up some logging for the state and dispatch our first action,  ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.