vpugh / react-select-us-states

React HTML Select component for US State Selection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Select US States

React HTML Select component for US State Selection.

Installation

The package can be installed via NPM:

npm install react-select-us-states --save

The list of US States were taken from here

Sample Usage:

import React, {Component} from 'react';
import './App.css';
import SelectUSState from 'react-select-us-states';

class App extends Component {

  constructor(props) {
    super(props);

    this.setNewValue = this.setNewValue.bind(this);
  }

  setNewValue(newValue) {
    console.log('this is the State code:' + newValue);
  }

  render() {
    return (
      <p>
        Select a state: <SelectUSState id="myId" className="myClassName" onChange={this.setNewValue}/>
      </p>
    );
  }
}

export default App;

About

React HTML Select component for US State Selection

License:MIT License


Languages

Language:JavaScript 100.0%