이제 스토어에 redux-saga 미들웨어를 적용해 줍시다.

    index.js

    import React from 'react';
    import ReactDOM from 'react-dom';
    import { createStore, applyMiddleware } from 'redux';
    import { Provider } from 'react-redux';
    import './index.css';
    import App from './App';
    import * as serviceWorker from './serviceWorker';
    import rootReducer, { rootSaga } from './modules';
    // import loggerMiddleware from './lib/loggerMiddleware';
    import { createLogger } from 'redux-logger';
    import ReduxThunk from 'redux-thunk';
    import createSagaMiddleware from 'redux-saga';
    
    const logger = createLogger();
    const sagaMiddleware = createSagaMiddleware();
    const store = createStore(
      rootReducer,
      applyMiddleware(logger, ReduxThunk, sagaMiddleware)
    );
    sagaMiddleware.run(rootSaga);
    
    ReactDOM.render(
      <Provider store={store}>
        <App />
      </Provider>,
      document.getElementById('root')
    );
    
    serviceWorker.unregister();

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.