adding fields to a redux form inside the component -


so have react component (called contract) being fed reduxform function. it's been given array of field names (the fields property shown below) part of form.

export default reduxform({  form: 'contract',  fields }, mapstatetoprops)(contract); 

but while component being created, there data (additional field names) being loaded server need appended list. data may not load in time. possible dynamically update list of fields , make them part of form after component has been created? can updated inside contract component or once component has been created list of fields set in stone?

i'm assuming you're using version 5 or earlier since you've got fields config. can make fields dynamic passing fields prop form component instead of configuring them in reduxform. (see docs)

i used stateful component in example fetch fields of course use redux-connected component.

class contractcontainer extends component {    state = { fields: [] };    componentdidmount() {     fetchdata().then(fields => {       this.setstate({ fields });     }   }    render() {     <contract fields={[...staticfields, ...this.state.fields]} />   }  } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -