immutability - redux-form/immutable, how to update state in reducer.plugin? -


currently i'm trying use redux-form/immutable in ma brand new project , i'm facing problems can't resolve (aspecially, cool reducer.plugin), couse i'm kinda new immutable , stuff that.

appreciating , advice or on topic.

so, first of all:

import { combinereducers } 'redux-immutable';  import routing './routereducer'; import { reducer formreducer } 'redux-form/immutable'; const rootreducer = combinereducers({ routing,     form: formreducer.plugin({         signupform: (state, action) => {             switch(action.type) {                 case 'signup_facebook':                     return {                         console.log(state);                     }                 default:                     return state             }         }     }) }); 

while non of forms field , touched console.log(state) returns undefined, here question: how may initialize form kind of state , update in on sort of action ('signup_facebook' example)?

here form code sample:

import react, { proptypes } 'react'; import { field, reduxform } 'redux-form/immutable'; import renderinputcontrol '../../../common/inputcontrol'; import validate './validate';  const signupform = (props) => {     const { handlesubmit, submitting, invalid } = props;     return (         <form onsubmit={handlesubmit} classname='signup__form'>             <field name='name' type='text' component={renderinputcontrol} label='full name'/>             <field name='email' type='email' component={renderinputcontrol} label='email'/>             <field name='password' type='password' component={renderinputcontrol} label='password'/>             <field name='tel' type='tel' component={renderinputcontrol} label='phone number'/>             <button type='submit' disabled={submitting || invalid}>sign up</button>          </form>     ); };  signupform.proptypes = {     handlesubmit: proptypes.func.isrequired,     onsubmit: proptypes.func,     submitting: proptypes.bool,     invalid: proptypes.bool };  export default reduxform({     form: 'signupform',     validate })(signupform); 

and second question is: after touch of fields (so state, e.g. console.log(state) returns map...), how should update it, couse code:

state.getin(['fields', 'name']).set('visited', false).set('touched', false) 

which should set 'touched' , 'visited' false doesn't anything?

best of luck!


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -