Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
Problem with component bound to an api with axios in React Native not rendering

I'm for the first time trying to consume an api with axios in react native.

My goal is to demonstrate the name of the state on the screen, from this api (https://servicodados.ibge.gov.br/api/v1/localidades/estados/), however, when I map it with only a {date.name}, but the content is not displayed.

What would I be doing wrong?

import React, { useEffect, useState } from "react";
import { Icon } from "react-native-elements";
import { View, TextInput, ScrollView, FlatList, Text } from "react-native";
import { Container, SearchInput, SearchInputText } from "./styles";
import Header from "../../components/Header";
import DashedCircle from "../../components/DashedCircle";

import axios from "axios";

export default (props) => {
  const [data, setData] = useState([]);

  useEffect(() => {
    async function fetchData() {
      const response = await axios.get(
        "https://servicodados.ibge.gov.br/api/v1/localidades/estados/"
      );

      setData(response.data);
    }

    fetchData();
  }, []);

  console.log(data);

  return (
    <>
      <DashedCircle />
      <Container>
        <Header onPress={() => props.navigation.goBack()} />

        <SearchInput>
          <SearchInputText placeholder="Buscar estado" />
          <Icon
            name="search-outline"
            type="ionicon"
            color="#c4c4c4"
            style={{
              paddingHorizontal: 15,
              paddingVertical: 15,
            }}
          />
        </SearchInput>

        {data.map((item) => {
          <Text>{data.nome}</Text>;
        })}
      </Container>
    </>
  );
};

app image

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are mapping data so call the name from item, try:

{data.map((item) => {
    <Text>{item.nome}</Text>
})}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda