Skip to content

Commit

Permalink
chore(redux): set up redux
Browse files Browse the repository at this point in the history
this chore will install redux and create a file structure for redux

[Delivers #160609506]
  • Loading branch information
mendozabree committed Nov 1, 2018
1 parent eb5f43a commit 8bcdabf
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 14 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"react": "^16.6.0",
"react-dom": "^16.6.0",
"react-router-dom": "^4.3.1",
"react-scripts": "2.0.5"
"react-scripts": "2.0.5",
"react-redux": "^5.1.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
10 changes: 7 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import Routes from './components/routes';
import './App.css';
import store from './store';

const App = () => (
<BrowserRouter>
<Routes />
</BrowserRouter>
<Provider store={store}>
<BrowserRouter>
<Routes />
</BrowserRouter>
</Provider>
);

export default App;
Empty file added src/actions/index.js
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/components/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
Route,
Switch,
} from 'react-router-dom';
import LandingPage from '../LandingPage';
import Login from '../Login';
import NotFound from '../NotFound';
import LandingPage from '../LandingPage/LandingPage';
import Login from '../Login/Login';
import NotFound from '../NotFound/NotFound';

const Routes = () => (
<Switch>
Expand Down
8 changes: 8 additions & 0 deletions src/reducers/rootReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { combineReducers } from 'redux';

const rootReducer = combineReducers({
// dummy object for reducer
user: () => ({}),
});

export default rootReducer;
12 changes: 12 additions & 0 deletions src/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers/rootReducer';

const store = createStore(
rootReducer,
{},
applyMiddleware(thunk),
);


export default store;
2 changes: 1 addition & 1 deletion src/tests/components/Landingpage.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shallow } from 'enzyme';
import React from 'react';
import LandingPage from '../../components/LandingPage';
import LandingPage from '../../components/LandingPage/LandingPage';


it('renders the LandingPage component correctly', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/Login.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shallow } from 'enzyme';
import React from 'react';
import Login from '../../components/Login';
import Login from '../../components/Login/Login';


it('renders the Login component correctly', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/NotFound.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shallow } from 'enzyme';
import React from 'react';
import NotFound from '../../components/NotFound';
import NotFound from '../../components/NotFound/NotFound';

it('renders the NotFound component correctly', () => {
const wrapper = shallow(<NotFound />);
Expand Down
7 changes: 3 additions & 4 deletions src/tests/routes/Index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { mount } from 'enzyme';
import LandingPage from '../../components/LandingPage';
import Login from '../../components/Login';
import NotFound from '../../components/NotFound';

import LandingPage from '../../components/LandingPage/LandingPage';
import Login from '../../components/Login/Login';
import NotFound from '../../components/NotFound/NotFound';

describe('Routes component', () => {
it('should return app component for the root path', () => {
Expand Down

0 comments on commit 8bcdabf

Please sign in to comment.