New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-validation-component

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-validation-component

![react validation component logo](https://raw.githubusercontent.com/dnbard/react-validation-component/master/public/logo.png)

npmnpm
Version
0.0.2
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

react validation component logo

React Validation Component is a utility component that solves data validation problem with the help of "native" React tool - prop-types.

Basic Example

Just show me the code!

import React, { Component } from 'react';
import ReactValidation from 'react-validation-component';
import PropTypes from 'prop-types';

class MyComponent extends Component{
  constructor(){
    super();

    this.state = { username: '', age: 0 };

    this.myForm = {
      username: PropTypes.string.isRequired
      age: PropTypes.number.isRequired
    };
  }

  onFormValidation(errors){
    // this method are going to be called on every validation
  }

  render(){
    const { username, age } = this.state;

    return <form>
      <ReactValidation propTypes={ this.myForm } onValidation={ this.onFormValidation.bind(this) }>{ this.state }</ReactValidation>

      <input name="username" value={ username } onChange={ e => this.setState({ username: e.target.value }) } />
      <input name="age" value={ age } onChange={ e => this.setState({ age: e.target.value }) } />
    </form>
  }
}

FAQs

Package last updated on 23 Jul 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