March 2019
Intermediate to advanced
534 pages
14h 52m
English
Let's walk through the major parts of this code, starting with the mock API function:
const fetchItems = () => new Promise(resolve => { setTimeout(() => { resolve([ { id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }, { id: 3, name: 'Item 3' } ]); }, 3000); });
The fetchItems() function simulates an API function by returning a promise that resolves an array of data after three seconds. This allows you to see what users will see while waiting for an actual API endpoint to respond. Next, let's look at the two utility components that help with rendering or hiding the select and the progress indicators:
const MaybeLinearProgress = ({ loading, ...props }) => loading ? <LinearProgress {...props} /> : null;const MaybeSelect = ({ ...Read now
Unlock full access