Storytel / react-redux-spinner

An automatic spinner for react and redux
https://storytel.github.io/react-redux-spinner/
MIT License
81 stars 13 forks source link

React redux spinner v2 #29

Closed domszyn closed 5 years ago

domszyn commented 5 years ago

React Redux has started using new React Context API in the latest release https://github.com/reduxjs/react-redux/releases/tag/v6.0.0

This is a breaking change because the legacy React context is no longer holding a reference to the Redux store.

The seemingly simplest way to fix this is to access ReactReduxContext directly, as described here https://react-redux.js.org/using-react-redux/accessing-store#using-reactreduxcontext-directly There are only 2 problems with this approach: it is not considered a part of the public React Redux API, and we have to make sure React Redux is imported from the single location only to be able to read the context value.

This PR fixes the issue by converting a <Spinner /> component into a connected one, using the connect API. This allows to access the store regardless of how it is stored in the context.

I have also upgraded all packages to their latest versions and added support for EcmaScript and CommonJS output.