0.6.0 • Published 6 years ago

react-collectable v0.6.0

Weekly downloads
15
License
ISC
Repository
github
Last release
6 years ago

react-collectable

Promise-based form validation logic for React.

Approach:

  • based on Promises
  • declarative, JSX-oriented
  • some assembly effort required
  • composition using function-as-child technique

Brief feature outline:

  • asynchronous validation support
  • pluggable, minimal and flexible

Sample Code

Sample code:

<Context>{(collect) => <Map>{(Parameter) =>
    <form onSubmit={() => doSomeAction(collect())} action="javascript:void(0)">
        <Parameter name="name"><Status>{(error, isPending) =>
            <label data-error={!!error}>
                <span>Name</span>
                <Input filter={requireText}><input
                    type="text"
                    placeholder="Enter Email"
                /></Input>
            </label>
        }</Status></Parameter>

        <Parameter name="email"><Status>{(error, isPending) =>
            <label data-error={!!error}>
                <span>Email</span>
                <Input filter={requireText}><input
                    type="text"
                    placeholder="Enter Email"
                /></Input>
            </label>
        }</Status></Parameter>

        <button type="submit">Submit</button>
    </form>
}</Map> }</Context>

Notes:

  • requireText is a validation filter function
  • doSomeAction receives a promise of the validated input data

To Do

  • brief example
  • sort out ES6 compilation
  • test on Babel
0.6.0

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago