Skip to content

Commit

Permalink
Redux Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
abolkog committed Dec 4, 2018
1 parent bf078d4 commit d7b7119
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 1 deletion.
61 changes: 61 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"formik": "^1.3.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-redux": "^5.1.1",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.1",
"reactstrap": "^6.5.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"yup": "^0.26.6"
},
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';

import 'bootstrap/dist/css/bootstrap.min.css';

import App from './App';
import * as serviceWorker from './serviceWorker';
import store from './store';

ReactDOM.render(
<BrowserRouter>
<App />
<Provider store={store}>
<App />
</Provider>
</BrowserRouter>,
document.getElementById('root')
);
Expand Down
5 changes: 5 additions & 0 deletions client/src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { combineReducers } from 'redux';

export default combineReducers({
auth: () => []
});
9 changes: 9 additions & 0 deletions client/src/store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import reducers from '../reducers';

const middlewares = [thunk];

const storeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

export default createStore(reducers, {}, storeEnhancer(applyMiddleware(...middlewares)));

0 comments on commit d7b7119

Please sign in to comment.