Jamie Hutber
Jamie Hutber

Reputation: 28076

Giving an input a default value in redux-form

I would have thought this is stupidly easy... but I am struggling :D

    <Field type="text" component="input" value="jamie" name="email" placeholder="Enter email address"/>
    <Field type="text" component="input" defaultValue="jamie" name="email" placeholder="Enter email address"/>
    <Field type="text" component="input" format="jamie" name="email" placeholder="Enter email address"/>

I just can't get one in there.

Upvotes: 2

Views: 3090

Answers (1)

Ashh
Ashh

Reputation: 46451

define initialValues outSide of your class

const initialValues = {
  email: '[email protected]'
}

and put initialValues here

export default reduxForm({
  form: 'venues',  // a unique identifier for this form
  destroyOnUnmount: true,
  validate,
  initialValue
})(VenueComponent)

Upvotes: 1

Related Questions