import React, { Component } from "react"; import PhoneInput, { normalize, format } from "../src"; class UtilityFunctions extends Component { state = { raw: "", normalized: "", formatted: "" }; handleChange = phoneNumber => { const formatted = format(phoneNumber); const normalized = normalize(phoneNumber); this.setState({ formatted, normalized, raw: phoneNumber }); }; render() { return (
Formatted: {this.state.formatted}
Normalized: {this.state.normalized}
); } } export default UtilityFunctions;