index.jsCounter.reducer.jsCounter.jsApp.js index.jsimport React from ‘react’; import ReactDOM from ‘react-dom’; import App from ‘./App’ import { createStore } from ‘redux’ import CounterReducer from ‘./Store/Reducer/Counter.reducer’ const store = createStore(CounterReducer) ReactDOM.render( <React.StrictMode> <App/> </React.StrictMode>, document.getElementById(‘root’) ); Counter.reducer.js Counter.js App.jsimport React, { Component } from‘react’ import Counter from ‘./Components/Counter’ /** redux react-redux 需要安装这2个包 / class App extends Component { render() { return ( <div> <Counter/> </div> ) } } export default App