import { getStatus } from 'redux-resource';
import store from './store';
const state = store.getState();
// The second argument to this method is a path into the state tree. This method
// protects you from needing to check for undefined values.
const readStatus = getStatus(store, 'books.meta[24].readStatus');
if (readStatus.pending) {
console.log('The request is in flight.');
else if (readStatus.failed) {
console.log('The request failed.');
else if (readStatus.succeeded) {
const book = state.books.resources[24];
console.log('The book was retrieved successfully, and here is the data:', book);