npm.io
0.11.0 • Published 8 years ago

@fyresite/react-textinput

Licence
ISC
Version
0.11.0
Deps
2
Vulns
1
Weekly
0

react-textinput

Base TextInput React Component built for internal Fyresite use.

Installation

npm install --save-dev @fyresite/react-textinput

Usage

import React, { Component } from 'react';
import TextInput from '@fyresite/react-textinput';

class Example extends Component {
  constructor(props) {
    super(props);
    
    this.state = {
      textInput: ''
    };
  }
  
  handleChange(field, e) {
    this.setState((prevState, props) => {
      return {
        [field]: e.target.value
      };
    });
  }
  
  render() {
    return (
      <TextInput
        onChange={this.handleChange.bind(this, 'textInput')}
        value={this.state.textInput} />
    );
  }
}