javascript - Using redux-form's Field with additional props -
i create higher-order component renders field component of redux-form library. problem like pass other props decorate component label, example. these input components usable without redux form.
one way of accomplishing following:
function mycomponent(props) {     return (         <div>             <label>{props.label}</label>             <field name={props.name} component="input" type="text" />         </div>     ) }   this good, redux-form throws error if component rendered without having been wrapped in reduxform({}).
another way following:
<field component={mycomponent} name="my-component" type="text" />   but doesn't allow me pass props, label mycomponent.
the current solution have come pass form={false} prop mycomponent render <input> if component not in form , <field> if component is in form. seems inelegant solution, i'd rather render same component regardless , not pass form prop.
is there functionality in redux-form allows passing of props <field> or allows <field> rendered outside of context of form? or limitation of redux-form?
 
 
  
Comments
Post a Comment