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

301
Views
ReactJS - console.log(ObjectName) //Working console.log(ObjectName.property) //Property not recognized

I will need help with the following code please

import React, {useEffect, useState} from "react";
import APIService from './service/ApiService'

export default function App() {

    useEffect(() => {
        APIService.getAdminApp('KYC').then(donnees => { //stats
            updateStats(donnees)
        }).catch(function (ex) {
            console.log('Erreur de parsing')
        });
    },[]);

    const [stats, updateStats] = useState([]);
    const keys = stats.application
    
    console.log(keys)
    
    
    return(<div>
    </div>);
}

The moment i do console.log(keys), the content of the object is displayed correctly.

enter image description here

But when I do console.log(keys.name), the property name is not recognized.

log don't working

Why? For information, my getAdminApp function in the useEffect uses a GET on an API fetch. Thanks you in advance.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Finally I did:

import React, {useEffect, useState} from "react";
import APIService from './service/ApiService'

export default function App() {

    useEffect(() => {
        APIService.getAdminApp('KYC').then(donnees => { //stats
            updateStats(donnees)
        }).catch(function (ex) {
            console.log('Erreur de parsing')
        });
    },[]);

    const [stats, updateStats] = useState([]);
    const keys = stats.application
    const array = stats.statistiqueList
    return(<div>
        <p>{keys?.name}</p>
        <p>{array[0]?.code}</p>
    </div>);
}

It's working, thanks you! ^^

about 4 years ago · Juan Pablo Isaza 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!