drfrf

0.0.3 • Public • Published

drfrf

CircleCI npm

Django REST framework - redux-form connector

Installation

$ yarn add drfrf

Usage

Compose the drfrf higher-order component with reduxForm:

import drfrf from "drfrf"
import { connect } from "react-redux"
import { compose } from "recompose"
 
const App = props => <form>...</form>
 
export default compose(
  drfrf({
    endpoint: "http://example.com/api/items/validate/",
  }),
  reduxForm({ ... })
)(App)

To-daa! Your form automatically queries the specified endpoint with every onChange and displays errors from the backend! 🎉

Browse the complete example here: https://github.com/Theodo-UK/drfrf/tree/master/example/frontend/src

API

drfrf exposes a single HOC which sets the asyncValidate prop for redux-form to use. This HOC accepts a configuration object with the following properties:

name default description
endpoint none URL to call with every change
method "POST" HTTP method to use

Backend integration

If you're using Django in your backend, check out drfrf for the backend.

Dependencies (0)

    Dev Dependencies (19)

    Package Sidebar

    Install

    npm i drfrf

    Weekly Downloads

    7

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    201 kB

    Total Files

    13

    Last publish

    Collaborators

    • as0n