react-google-places-search
v1.0.0
Published
Google places autocomplete hook for ReactJS
Downloads
1
Readme
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>
);
);