react-redux知识点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了react-redux知识点相关的知识,希望对你有一定的参考价值。

1.定义组件;

2.定义action;

3.定义Reducer:reducer1(state,action);

4.定义store:store(reducer1);

5.定义mapStateToProps(state);

6.定义mapDispatchToProps(dispatch);

7.定义connect:

const App = connect(
    mapStateToProps,
    mapDispatchToProps
)(组件);

8.渲染元素:

ReactDOM.render(
    <Provider store={store}>
        <App />
    </Provider>,
    document.getElementById(‘page‘)
);

 

以上是关于react-redux知识点的主要内容,如果未能解决你的问题,请参考以下文章