1.0.0 • Published 3 years ago

react-google-places-search v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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>
  );
);