Skip to main content
Pregunta traducida
Origen Enlace

Geoapify Geocoder Autocomplete placeSelect on React not working properlyno esta funcionando correctamente con react?

Im trying to use the autocomplete address component with freeEstoy usando el componente para automcompletar direcciones con la API named @geoapify/react-geocoder-autocomplete inen un proyecto en React. Already downloaded Ya me baje las librerías (downloaded geoapify/autocomplete andy geoapify/react-autocomplete, tried a lot of things but) y seguí los tutoriales de la documentación pero pareciera que placeSelect is not working.no esta funcionando

geoapify repo: https://github.com/geoapify/react-geocoder-autocomplete

Reinstalled every dependency, cried on the floorIntente reinstalar las dependencias, but nothing appears on Consolereiniciar toda la compu, don´t know what to do anymore. Please help mepero sigue sin aparecer nada en la consola.

Here's my codeEste es mi codigo:

import React, { useState } from "react";
import {
    GeoapifyGeocoderAutocomplete,
    GeoapifyContext
} from "@geoapify/react-geocoder-autocomplete"; 
import "@geoapify/geocoder-autocomplete/styles/round-borders.css";

const API_KEY = "xxx";

export default function Autocomplete() {
    const [info, setInfo] = useState(null);

    function onPlaceSelect(data) {
        setInfo(data);
        console.log(info);
    }

    return (
        <div>
            <GeoapifyContext apiKey={API_KEY}>
                <GeoapifyGeocoderAutocomplete
                    placeSelect={onPlaceSelect}
                    placeholder="Ingresá una ciudad"
                    allowNonVerifiedHouseNumber={true}
                    allowNonVerifiedStreet={true}
                />
            </GeoapifyContext>
            <section>
                <h2>Output</h2>
            </section>
        </div>
    );
}

Tambien intente inicializar el useState en otro valor, y que lo muestre en pantalla pero nunca se actualizó. Pareciera que nunca llego a ejecutarse el onPlaceSelect? Alguien más ya tuvo este problema?

Cualquier ayuda será agradecida eternamente.

Geoapify Geocoder Autocomplete placeSelect on React not working properly

Im trying to use the autocomplete address component with free API named @geoapify/react-geocoder-autocomplete in React. Already downloaded geoapify/autocomplete and geoapify/react-autocomplete, tried a lot of things but placeSelect is not working.

geoapify repo: https://github.com/geoapify/react-geocoder-autocomplete

Reinstalled every dependency, cried on the floor, but nothing appears on Console, don´t know what to do anymore. Please help me.

Here's my code:

import React, { useState } from "react";
import {
    GeoapifyGeocoderAutocomplete,
    GeoapifyContext
} from "@geoapify/react-geocoder-autocomplete"; 
import "@geoapify/geocoder-autocomplete/styles/round-borders.css";

const API_KEY = "xxx";

export default function Autocomplete() {
    const [info, setInfo] = useState(null);

    function onPlaceSelect(data) {
        setInfo(data);
        console.log(info);
    }

    return (
        <div>
            <GeoapifyContext apiKey={API_KEY}>
                <GeoapifyGeocoderAutocomplete
                    placeSelect={onPlaceSelect}
                    placeholder="Ingresá una ciudad"
                    allowNonVerifiedHouseNumber={true}
                    allowNonVerifiedStreet={true}
                />
            </GeoapifyContext>
            <section>
                <h2>Output</h2>
            </section>
        </div>
    );
}

Geoapify Geocoder Autocomplete placeSelect no esta funcionando correctamente con react?

Estoy usando el componente para automcompletar direcciones con la API @geoapify/react-geocoder-autocomplete en un proyecto en React. Ya me baje las librerías (downloaded geoapify/autocomplete y geoapify/react-autocomplete) y seguí los tutoriales de la documentación pero pareciera que placeSelect no esta funcionando

geoapify repo: https://github.com/geoapify/react-geocoder-autocomplete

Intente reinstalar las dependencias, reiniciar toda la compu, pero sigue sin aparecer nada en la consola.

Este es mi codigo:

import React, { useState } from "react";
import {
    GeoapifyGeocoderAutocomplete,
    GeoapifyContext
} from "@geoapify/react-geocoder-autocomplete"; 
import "@geoapify/geocoder-autocomplete/styles/round-borders.css";

const API_KEY = "xxx";

export default function Autocomplete() {
    const [info, setInfo] = useState(null);

    function onPlaceSelect(data) {
        setInfo(data);
        console.log(info);
    }

    return (
        <div>
            <GeoapifyContext apiKey={API_KEY}>
                <GeoapifyGeocoderAutocomplete
                    placeSelect={onPlaceSelect}
                    placeholder="Ingresá una ciudad"
                    allowNonVerifiedHouseNumber={true}
                    allowNonVerifiedStreet={true}
                />
            </GeoapifyContext>
            <section>
                <h2>Output</h2>
            </section>
        </div>
    );
}

Tambien intente inicializar el useState en otro valor, y que lo muestre en pantalla pero nunca se actualizó. Pareciera que nunca llego a ejecutarse el onPlaceSelect? Alguien más ya tuvo este problema?

Cualquier ayuda será agradecida eternamente.

Origen Enlace

Geoapify Geocoder Autocomplete placeSelect on React not working properly

Im trying to use the autocomplete address component with free API named @geoapify/react-geocoder-autocomplete in React. Already downloaded geoapify/autocomplete and geoapify/react-autocomplete, tried a lot of things but placeSelect is not working.

geoapify repo: https://github.com/geoapify/react-geocoder-autocomplete

Reinstalled every dependency, cried on the floor, but nothing appears on Console, don´t know what to do anymore. Please help me.

Here's my code:

import React, { useState } from "react";
import {
    GeoapifyGeocoderAutocomplete,
    GeoapifyContext
} from "@geoapify/react-geocoder-autocomplete"; 
import "@geoapify/geocoder-autocomplete/styles/round-borders.css";

const API_KEY = "xxx";

export default function Autocomplete() {
    const [info, setInfo] = useState(null);

    function onPlaceSelect(data) {
        setInfo(data);
        console.log(info);
    }

    return (
        <div>
            <GeoapifyContext apiKey={API_KEY}>
                <GeoapifyGeocoderAutocomplete
                    placeSelect={onPlaceSelect}
                    placeholder="Ingresá una ciudad"
                    allowNonVerifiedHouseNumber={true}
                    allowNonVerifiedStreet={true}
                />
            </GeoapifyContext>
            <section>
                <h2>Output</h2>
            </section>
        </div>
    );
}