@k-ramel/driver-redux-form

Redux-form driver for k-ramel

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@k-ramel/driver-redux-form
Minified + gzip package size for @k-ramel/driver-redux-form in KB

Readme

@k-ramel/driver-redux-form

Redux Form driver for k-ramel

Install it

yarn add @k-ramel/driver-redux-form regeneratorRuntime

Note

You have to wrap your application with react-redux Provider and giving the k-ramel store created via createStore in order to work.

Examples

In store definition (See main documentation about description)

/* store.js */
import { createStore } from 'k-ramel'
import reduxform from '@k-ramel/driver-redux-form'

export default createStore(
  {
    /* your store description */
  },
  {
    drivers: {
      form: reduxform({ path: 'ui.form', getState: state => state.ui.form }) // default is { path: 'form' }
    },
  },
)

In a reaction (See main documentation about listeners/reactions)

/* reaction.js */

export const signin = (store, action, drivers) => {
  const { form, http } = drivers
  const signinForm = form('signin')
  const loginValues = signinForm.getFormValues()
  // check login is not empty
  if (loginValues.login && loginValues.password) {
    signinForm.setSubmitSucceeded()
  } else {
    signinForm.setSubmitFailed()
  }
}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.