Skip to content

Instantly share code, notes, and snippets.

@alanbsmith
Created January 15, 2018 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanbsmith/2617f9c12f52e9a804db3ae73c52225c to your computer and use it in GitHub Desktop.
Save alanbsmith/2617f9c12f52e9a804db3ae73c52225c to your computer and use it in GitHub Desktop.
// src/components/App/index.js
import React, { Component } from "react";
import classNames from 'classnames';
import { validatePhone } from 'input-validator-lib';
import "src/assets/stylesheets/base.scss";
class App extends Component {
constructor(props) {
super(props);
this.state = {
inputError: false,
phoneNumber: ""
};
}
handleChange(phoneNumber) {
const inputError = !validatePhone(phoneNumber);
this.setState({
inputError,
phoneNumber,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment