Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 481 | Rev 1727 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 481 Rev 593
Línea 1... Línea 1...
1
import { useState, useEffect } from 'react'
1
import { useState, useEffect, useRef } from 'react'
Línea 2... Línea 2...
2
 
2
 
3
const useLocationAutocomplete = (inputRef) => {
3
const useLocationAutocomplete = () => {
4
    const [addresObject, setAddressObject] = useState({})
4
    const [addresObject, setAddressObject] = useState({})
-
 
5
    const [error, setError] = useState(null)
5
    const [error, setError] = useState(null)
6
    const inputRef = useRef(null)
Línea 6... Línea 7...
6
    let autoComplete
7
    let autoComplete
7
 
8
 
8
    function handleScriptLoad(autoCompleteRef) {
9
    function handleScriptLoad(autoCompleteRef) {
Línea 77... Línea 78...
77
 
78
 
78
    useEffect(() => {
79
    useEffect(() => {
79
        handleScriptLoad(inputRef)
80
        handleScriptLoad(inputRef)
Línea 80... Línea 81...
80
    }, [])
81
    }, [])
81
 
82
 
Línea 82... Línea 83...
82
    return { address: addresObject, error }
83
    return { address: addresObject, error, ref: inputRef }