Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-collectable

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-collectable

Promise-based form validation logic for React

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 04 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc