Closed wicho1001 closed 4 years ago
I just wrote your class component to a functional component. here´s the code
import React, { useState } from "react"; import LocationPicker from 'react-location-picker'; const LocationPickerComponent = () => { const defaultPosition = { lat: 27.9878, lng: 86.9250 }; const [location, setLocation] = useState({ address: "Kala Pattar Ascent Trail, Khumjung 56000, Nepal", position: { lat: 0, lng: 0 } }) const handleLocationChange = ({ position, address } = location) => { setLocation({ position, address }); } React.useEffect(() => { handleLocationChange(); }, []) return ( <> <LocationPicker containerElement={ <div style={ {height: '100%'} } /> } mapElement={ <div style={ {height: '223px'} } /> } defaultPosition={defaultPosition} onChange={handleLocationChange} /> </> ) } export default LocationPickerComponent; ;
@wicho1001 Sorry for the late attention. If you're still willing to contribute to the docs send a PR updating the docs.
I just wrote your class component to a functional component. here´s the code