import React, {Component} from 'react';
import {connect} from 'react-redux';
import addTask from '../actions/addTask';
import ComponentAddForm from '../components/AddForm';
class AddForm extends Component{
render(){
return(
<ComponentAddForm error = {this.props.errors} add = {this.props.add} id={this.props.id + 1}/>
);
}
}
const mapStateToProps = (state) => ({
errors: state.errors.text,
id: state.addDelete.tasks[state.addDelete.tasks.length-1].id
});
const mapDispatchToProps = {
add : addTask
};
export default connect(mapStateToProps, mapDispatchToProps)(AddForm);
import {createStore, compose, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers/index';
export default function configurateStore(initialState){
let store = createStore(
rootReducer,
compose(
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : f => f
)
);
return store;
}
import {combineReducers} from 'redux';
import addDelete from './addDelete';
import errors from './errors';
import clock from './clock';
export default combineReducers({
addDelete,
errors,
clock
});