Skip to main content

14.08 Connecting React To Redux

index.js

index.js
import React from "react";
import ReactDOM from "react-dom";
import { createStore } from "redux";
import App from "./App";
import "./index.css";
import registerServiceWorker from "./registerServiceWorker";
import reducer from "./store/reducer";

const store = createStore(reducer);

ReactDOM.render(<App />, document.getElementById("root"));
registerServiceWorker();

reducer.js

reducer.js
const initialState = {
counter: 0,
};

const reducer = (state = initialState, action) => {
return state;
};

export default reducer;