react redux provider code example

Example 1: react-redux provider

/* Using 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>
        );
    }
}

Example 2: redux import connect

import { connect } from 'react-redux'