<commit_before>var React = require('react');
var iz = require('iz');
var are = iz.are;
var validators = iz.validators;

var Form = React.createClass({

  getInitialState: function() {
    return { null };
  },

  render: function() {
    return (
      <form> 
        <input type="text" placeholder="username" />
        <input type="text" placeholder="password" />
        <button type="button">Submit</button>
      </form>
    );
  },

  handleSubmit: function() {

  }

});

React.render(
  <Form />,
  document.body
);<commit_msg>finished example registration form with iz validations. data is stored in localstorage<commit_after>var React = require('react');
var iz = require('iz');
var are = iz.are;
var validators = iz.validators;
var saveData = JSON.parse(localStorage.saveData || null) || {};

var Form = React.createClass({

  getInitialState: function() {
    return { click: !false };
  },

  render: function() {
    return (
      <form>
        <label> Username </label> 
        <input type="text" ref="username" />
        
        <label> Password </label>
        <input type="password" ref="password" />
        <button type="button" onClick={this.handleSubmit}>Submit</button>
      </form>
    );
  },

  handleSubmit: function(e) {
    e.preventDefault();

    var data = {
      username: this.refs.username.getDOMNode().value,
      password: this.refs.password.getDOMNode().value
    };

    this.dataValidator(data);
  },

  dataValidator: function(data) {
    var usernameErrors = {
      alphaNumeric: 'Username should consist numbers and letters only!'
    };

    var passwordErrors = {
      alphaNumeric: 'Password should consist numbers and letters only!'
    };

    var rules = {
      username: iz(data.username, usernameErrors).required(),
      password: iz(data.password, passwordErrors).required()
    }

    var areRules = are(rules);
    var success = areRules.valid();
    success ? 'data is prepared for saving!' : 'throw error';
    
    saveData.data = data;
    saveData.time = new Date().getTime();
    localStorage.saveData = JSON.stringify(saveData);

    alert("Data is stored! Congratulations!!");
  }

});

React.render(
  <Form />,
  document.body
); 
{'fraction_non_alphanumeric': 0.14583333333333334, 'fraction_numerical': 0.0, 'mean_word_length': 2.9516994633273703, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3364919', 'n_tokens_mistral': 666, 'n_tokens_neox': 648, 'n_words': 160}