September 2018
Intermediate to advanced
302 pages
7h 17m
English
If you paid close attention to the previous examples, you may have spotted an interesting part – withStoreProvider. This is a higher order component I made to wrap the root component with the react-redux store Provider:
import { Provider } from 'react-redux';// ...<Provider store={store}> <WrappedComponent {...props} /></Provider>
The Provider that is exposed is very similar to the React context API. The context was in the React library for a long time, along with an experimental API. However, the newest context API was introduced with React 16 and you may notice that old libraries still use their own custom providers. For instance, have a look at the react-redux Provider implementation, as follows:
class Provider extends ...
Read now
Unlock full access