Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
axios and react-native api data export problem

I'm trying to export the data that I pulled from axios in my stock market tracking software from a js file and import it to the main screen of my project, but the output is not what I want. I want to print the data on my main screen, but I get a promise output.

api.js

import axios from "axios";


 async function fetchApi(){
    const response = await axios.get("http://hasanadiguzel.com.tr/api/kurgetir");
    return  response.data
} 
export default fetchApi;

main.js

import fetchApi from "../api/fethApi";
    const [dovizData, setDovizData] = useState();

    const getJSON = () =>{
        setDovizData(fetchApi());
        console.log(dovizData);
    }
    setTimeout(getJSON,3000)

Output

Promise {<fulfilled>: Array(23)}
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

use Async/await to get promise data

import fetchApi from "../api/fethApi";

const [dovizData, setDovizData] = useState();

const getJSON = async () => {
  const res = await fetchApi();
  setDovizData(res);
  console.log(dovizData);
}
setTimeout(getJSON, 3000)

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!