react-google-places-search

1.0.0 • Public • Published

React Google Places Autocomplete hook

This is the Fork of tintef/react-google-places-autocomplete

Getting started

Install the latest version:

npm install --save npm i @erslee/react-google-places-seach
  or
yarn add npm i @erslee/react-google-places-seach

Use the hook in the component!

import React from 'react';
import useGooglePlacesSearch from '@erslee/react-google-places-search';

const Component = () => (
const [{ places, loading, serviceStatus }, autocomplete] = useGooglePlacesSearch({
    apiKey: '***'
  });

  const handleInput = (e) => {
    const value = e.target.value;
    autocomplete(value);
  }

  const [value, inc, dec] = useCounter()
  return (
    <div className="App">
      <input onChange={handleInput} />
      {places && places.map(item => <li>item.label</li>)}
    </div>
  );
);

Readme

Keywords

none

Package Sidebar

Install

npm i react-google-places-search

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

89.7 kB

Total Files

7

Last publish

Collaborators

  • erslee