Learn how to use the that comes with React Redux instead of the hand-rolled implementation from the previous lesson.
In the previous session, we implemented the Provider component that uses the react advanced context feature to make this tool from the props available to every component in our app.
If we pass it through the Provider, we can read it in any other component from the context, which is really convenient for the container components. In fact, this is so convenient that you don't need to actually write the Provider yourself, because it is included in a special library called React-Redux.
Note that it is not the same as Redux. This is a different library. These are react bindings to the Redux library. You can import the Provider by destructuring the react-redux global object in JS bin, or if you use Babel, and something like NPM, you can import Provider with the braces, because it's a named expert from React-Redux package. Or if you write ES5 code, you can write var Provider = require('react-redux').Provider;
const { Provider } = ReactRedux;
// import { Provider } from 'react-redux';
// var Provider = require('react-redux').Provider;
Just like the Provider we wrote before, the Provider that comes with react-redux exposes this store you passed through. There's a prop on the context so the components can specify the contextTypes, and then use this context store to subscribe to the store updates and dispatch actions.
Comment Guidelines
Member comments are a way for PRO Members to communicate, interact, and ask questions about a lesson.
Commenting Guidelines
Here are some basic guidelines for commenting on egghead.io.
Be on-topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact click here.
Avoid meta-discussion
Is your comment resembles:
It will likely be deleted as "meta".
Code problem?
Should be accompanied by code! JSFiddle, Plunker, CodePen, etc all provide a way to share code and discuss it in context.
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!
egghead.io comment guidelines
Learn how to use the that comes with React Redux instead of the hand-rolled implementation from the previous lesson.
Microsoft XAML has a property called DataContext which is exposed in it's XAML controls. The Redux pattern described here is the same that XAML had many years ago.