Add in PropTypes so that we give our users feedback on whether or not they are passing the correct parameters. (They can remove them in production using babel-plugin-transform-react-remove-prop-types.)
Capture the promise that is performing the fetch, so that we can cancel it on unmount. This saves a memory leak and a warning message whenever someone navigates away before the fetch resolves.
Switch to Bluebird so that we have the promise.cancel() functionality required in #3.
Chain the promises, so multiple rapid changes would still all be cancelled on unmount.
This PR does the following things:
PropTypes
so that we give our users feedback on whether or not they are passing the correct parameters. (They can remove them in production usingbabel-plugin-transform-react-remove-prop-types
.)fetch
, so that we can cancel it on unmount. This saves a memory leak and a warning message whenever someone navigates away before thefetch
resolves.promise.cancel()
functionality required in #3.