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

245
Views
Axios get url + state return undefined state even if the state exists

I do an axios get(url + this.state.user) but the parameter is undefined for no reason because when i do a console log of the parameter it exists...

My code

    state = {
        user: [],
        taches : [],
        loading: false
    }

    componentDidMount = () => {
        this.setState({loading:true})
        axios.get('/get-user').then(response => {
                this.setState({user : response.data});
        }).catch(error => {
            console.log(error);
        })
        axios.get('/get-taches/' + this.state.user.ID_Users).then(response => {
            console.log(this.state.user.ID_Users);
        }).catch(error => {
            console.log(this.state.user.ID_Users);
            console.log(error);
        })
    }

The parameter of axios get-taches return undefined but when i do a console log of it in the catch error it is defined and it shows in the console... I dont know where the problem is.

Thank you for your help

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