reactjs - Passing helper text to redux-form -


i'm using redux-form 6.0.0-rc.4 , i'm wondering if there's way pass additional property fields.

here's renderfield component:

const renderfield = field => (   <div classname={field.touched && field.error ? 'invalid' : 'valid'}>     <label>{field.input.placeholder}</label>     <input {...field.input} />     {field.touched && field.error && <span><i classname="fa fa-warning"></i> {field.error}</span>}   </div> ); 

and field:

<field name="addressone" type="text" placeholder="address one" component={renderfield} /> 

i'd able pass helper text directly field can include in renderfield. docs show redux-form extremely flexible, there doesn't seem easy way achieve this.

edit --

when "helper text", mean copy guide user. example, on date field i'd add text along lines of "the selected date must 2 business days now" , on select field might "please choose 1 list". different each field.

it's easy: props pass field aren't used redux-form passed on component. i've added helptext example show how works.

const renderfield = field => (   <div classname={field.touched && field.error ? 'invalid' : 'valid'}>     <span>{field.helptext}</span>     <label>{field.input.placeholder}</label>     <input {...field.input} />     {field.touched && field.error && <span><i classname="fa fa-warning"></i> {field.error}</span>}   </div> ); 

and field:

<field name="addressone" type="text" placeholder="address one" component={renderfield} helptext="this custom text." /> 

this noted point 3 in field documentation redux-form v6.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -