Skip to content

Commit

Permalink
setup reduxform
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxnelson997 committed Jul 10, 2018
1 parent dcd6b8a commit 096ace5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
20 changes: 20 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@
"react-dom": "^16.0.0",
"react-redux": "5.0.6",
"react-router-dom": "^4.2.2",
"redux": "^3.7.2",
"reactstrap": "^5.0.0-alpha.4",
"redux": "^3.7.2",
"redux-form": "^7.4.2",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"url-loader": "^0.5.9",
Expand Down
12 changes: 7 additions & 5 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { createStore, applyMiddleware, compose } from 'redux';
import { Router, Switch, Route } from 'react-router-dom';
import reducers from './reducers';

const createStoreWithMiddleware = applyMiddleware()(createStore);
const createStoreWithMiddleware = applyMiddleware()(compose((window.devToolsExtension ? window.devToolsExtension() : f => f)(createStore)));

import './style/main.scss';

Expand All @@ -20,9 +20,11 @@ function main() {
<Provider store={createStoreWithMiddleware(reducers)}>
<Router history={history}>
<Layout>
<Switch>
<Route path='/' exact component={Signin}/>
</Switch>
<Switch>
<Route path='/' exact component={Signin}/>
<Route path='/signin' exact component={Signin}/>
<Route path='/signup' exact component={Signup}/>
</Switch>
</Layout>
</Router>
</Provider>
Expand Down
6 changes: 6 additions & 0 deletions src/components/auth/signin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { Component } from 'react';

import { reduxForm, Field } from 'redux-form';

class SignIn extends Component {
render() {
return (
Expand All @@ -10,4 +12,8 @@ class SignIn extends Component {
}
}

SignIn = reduxForm({
form: 'SignIn'
})(SignIn);

export default SignIn;
3 changes: 2 additions & 1 deletion src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { combineReducers } from 'redux';
import { reducer as form } from 'redux-form';

const rootReducer = combineReducers({
state: (state = {}) => state
form
});

export default rootReducer;

0 comments on commit 096ace5

Please sign in to comment.