File size: 788 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React from 'react';
import ReactDOM from 'react-dom';

// Redux stuff
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux'
import promiseMiddleware from 'redux-promise';

import App from './components/App/App';
import reducers from './reducers'
import './index.css';

// sending in our promise middleware
// this will return a function called higher order function that we are directly going to invoke with createStore as parameter
const storeWithMiddleware = applyMiddleware(promiseMiddleware)(createStore) //created store with middleware

// Middleware needs to know what reducers it should use
ReactDOM.render(<Provider store={storeWithMiddleware(reducers)}>
        <App />
    </Provider>,
        document.getElementById('root')
    );