index.js 1.21 KB
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { Provider } from 'react-redux'  // app에 redux를 연결시켜주기 위해 redux에서 제공하는 provider 사용
import { createStore } from 'redux';  // redux에서 createStore 가져옴.
import { applyMiddleware } from 'redux';  // object만 받는 store가 promise나 functions도 받기 위해 middleware을 사용함
import promiseMiddleware from 'redux-promise';
import ReduxThunk from 'redux-thunk';
import Reducer from './_reducers/index'

import 'antd/dist/antd.css';


const createStoreWithMiddleware = applyMiddleware()

ReactDOM.render(
  // App에 Redux를 연결
  <Provider
    store={createStoreWithMiddleware(Reducer,
      // chrome REDUX_DEVTOOLS extension 사용하기 위해서
      window.__REDUX_DEVTOOLS_EXTENSIONS__ && 
      window.__REDUX_DEVTOOLS_EXTENSIONS__()
      )}
  >

    <App />
  </Provider>
);

// If you want to start measuring performance in your app, pass a function
// to log resu lts (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();