import React from "react"
import ReactDOM from 'react-dom'
import App from './App.js'
import { createStore } from 'redux'//创建一个 Redux store 来以存放应用中所有的 state
import { Provider } from 'react-redux' //包裹顶级组件,将store传递下去
import reducer from './index.reducer'
//创建store
const store = createStore(reducer);//初始化state,以及reducer函数
ReactDOM.render(
<Provider store={store}>
<App></App>
</Provider>
,document.getElementById('root'))
第一步创建store,包裹顶级组件,传递storeimport React from "react"import ReactDOM from 'react-dom'import App from './App.js'import { createStore } from 'redux'//创建一个 Redux store 来以存放应用中所有的 stateimport { Provider } from 'react-redux' //包裹顶级组件,将store传递下去import reduce