#API
Provider负责将store提交给React的root组件,例如例子中的
//index.js import {Provider} from 'react-redux' render( <Provider store={store}> <App/> </Provider>,)
配合React-Router使用,Provider则依旧被放置在最顶层。
import {Provider} from 'react-redux' import {Router,Route,browserHistory,IndexRoute} from 'react-router' ReactDOM.render( <Provider store={store}> <Router history={browserHistory}> <Route path='/' component={App}> </Route> </Router> </Provider> )原文链接:https://www.f2er.com/react/306631.html