react redux provider store code example
Example: react-redux provider
import React from 'react';
import { Provider, connect } from 'react-redux';
const mapStateToProps = (state) => {
return { myProp: state.myProp }
};
const mapDispatchToProps = (dispatch) => {
return { propName: (param) => { dispatch(actionCreator(param)) } }
};
const Container = connect(mapStateToProps, mapDispatchToProps)(App);
export default class AppWrapper extends React.Component {
render() {
return (
<Provider store={store}>
<Container />
</Provider>
);
}
}