-

   rss_habrahabr_of_lokoman

 - e-mail

 

 -

 LiveInternet.ru:
: 16.03.2008
:
:
: 2

:


[ ] React. 1

, 18 2018 . 22:03 +
react-validation-boo, react .

npm install react-validation-boo

, .

import React, {Component} from 'react';
import {connect, Form, Input, logger} from 'react-validation-boo';

class MyForm extends Component {
    sendForm = (event) => {
        event.preventDefault();

        if(this.props.vBoo.isValid()) {
            console.log('       ', this.props.vBoo.getValues());
        } else {
            console.log('   ', this.props.vBoo.getErrors());
        }
    };
    getError = (name) => {
        return this.props.vBoo.hasError(name) ? 
{this.props.vBoo.getError(name)}
: ''; }; render() { return
{this.getError('name')}
} } export default connect({ rules: () => ( [ ['name', 'required'], ] ), middleware: logger })(MyForm);

https://habr.com/post/430312/?utm_source=habrahabr&utm_medium=rss&utm_campaign=430312

:  

: [1] []
 

:
: 

: ( )

:

  URL