Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from "react";
- import {reduxForm, Field } from "redux-form";
- import ItemField from "./ItemField";
- class ItemForm extends Component {
- render(){
- const {handleSubmit} = this.props;
- return(
- <div>
- <div className="box" id="">
- <form className="item" onSubmit={handleSubmit}>
- <Field type="text" name="taskName" component={ItemField} placeholder="Add Item"/>
- <button type="submit">+</button>
- </form>
- </div>
- </div>
- );
- }
- }
- function validate(values){
- const errors = {};
- if (!values.taskName) {
- errors.taskName ="You must provide a task name";
- }
- return errors;
- }
- export default reduxForm({
- validate,
- form: "itemForm"
- })(ItemForm);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement