How to use the redux-form.reducer.plugin function in redux-form

To help you get started, we’ve selected a few redux-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shalomeir / snippod-boilerplate / snippod-webapp / src / ducks / reduxform / reduxform.js View on Github external
import { reducer as formReducer } from 'redux-form';

const RESET_ALL_REDUX_FORM = 'reduxform/reduxForm/RESET_ALL_REDUX_FORM';

const reduxForm = formReducer.plugin({

  login: (state, action) => { // <------ 'login' is name of form given to reduxForm()
    const { INIT_ALL_STATE } = require('ducks/globalActions');

    switch (action.type) {
      case INIT_ALL_STATE:
      case RESET_ALL_REDUX_FORM:
        return {
          // <----- clear all field
        };
      default:
        return state;
    }
  },

});
github jsdmc / react-redux-router-crud-boilerplate / src / redux-base / modules / reducer.js View on Github external
import multireducer from 'multireducer';

export default combineReducers({
  routing: routerReducer,
  auth,
  counter,
  multiCounters: multireducer({
    counter1: counter,
    counter2: counter,
    counter3: counter
  }),
  myNamespace: combineReducers({
    someCustomCounter: multireducer(customCounter, 'customCounter'), // <-- catch actions that contain the key
  }),
  form: formReducer.plugin(loginFormPlugin),
  movies
});
github leozdgao / taskbox / src / redux / modules / form.js View on Github external
return {
      ...state,
      oldpwd: {} // set old password to empty if error
    }
  }
}
const editPostActionMap = {
  "redux-form/CHANGE" ( state, action ) {
    return {
      ...state,
      isDirty: true
    }
  }
}

const reducer = formReducer.plugin({
  changePassword: createReducer(actionMap),
  editPost: createReducer(editPostActionMap)
})

export default reducer
github DefinitelyTyped / DefinitelyTyped / types / redux-form / v7 / redux-form-tests.tsx View on Github external
bar={23}
                            />

                        
                    
                
            );
        }
    }
);

reducer({}, {
    type: "ACTION"
});

reducer.plugin({
    myForm: (state: any, action: FormAction) => {
        if (action.type === actionTypes.CHANGE && action.meta.form === "securitySettings") {
            return {
                ...state,
                values: {
                    ...state.values,
                    downloadLinkAutoPassword: true,
                },
            };
        } else {
            return state;
        }
    }
});

try {
github sshwsfc / xadmin / packages / xadmin-form / src / index.js View on Github external
reducers: (app) => {
    const plugins = app.get('form_reducer')
    return { form: formReducer.plugin(plugins) }
  },
  hooks: {
github lemonCMS / redux-form-generator / example / src / redux / modules / reducer.js View on Github external
import {combineReducers} from 'redux';
import {reducer as formReducer} from 'redux-form';
import {routerStateReducer} from 'redux-router';
import reduxFormReducer from './reduxForm/reducer';

export default combineReducers({
  router: routerStateReducer,
  form: formReducer.plugin(reduxFormReducer)
});
github sshwsfc / xadmin / src / form / index.js View on Github external
reducers: (app) => {
      const plugins = app.load_dict('form_reducer')
      return { form: formReducer.plugin(plugins) }
    },
    form_fields: default_fields,
github i-novus-llc / n2o-framework / frontend / n2o / src / reducers.js View on Github external
const formHack = (state, action) => {
  return action.meta && action.meta.form
    ? formReducer.plugin({
        [action.meta.form]: (formState, formAction) => {
          return Object.assign(
            {},
            formState,
            formPlugin(formState, formAction)
          );
        },
      })(state, action)
    : formReducer(state, action);
};
const rootReducer = combineReducers({
github Darmody / DoubanFMac / src / reducers / form.js View on Github external
import { reducer as formReducer } from 'redux-form';
import signin from './form/signin';

export default formReducer.plugin({
  signin,
});
github saadq / resumake.io / app / client / src / reducers / form.js View on Github external
return {
        ...state,
        values: {
          ...state.values,
          awards: state.values.awards.slice(0, -1)
        }
      }

    default:
      return state
  }
}

export { form }
export default reducer.plugin({ resume: form })