react-autofill-address

1.0.15 • Public • Published

React Autofill Address

React component for google address autofill, this component will try to find an address on any input change

npm install react-autofill-address --save

import React, { Component } from 'react'
import Address from 'react-autofill-address'
 
export default class extends Component {
  constructor (props) {
    super(props)
    this.state = {}
  }
  setPlace (place) {
    this.setState({ place })
  }
  render () {
    const { place } = this.state
    return <div>
      <Address
      apikey={process.env.GOOGLE_API_KEY}
      onChange={place => this.setPlace(place)}
      timer={300} // Throttle the onChange event
      />
      <pre>{JSON.stringify(place, null, 2)}</pre>
    </div>
  }
}

Package Sidebar

Install

npm i react-autofill-address

Weekly Downloads

3

Version

1.0.15

License

ISC

Unpacked Size

19.8 kB

Total Files

11

Last publish

Collaborators

  • rphansen91