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

199
Views
how to use the state of a variable for another class in react?

I wanted to use in props."restaurants".map. What could I do to use this variable in Editar2.js?

---App.js---

const { restaurantes } = this.state;

---Editar2.js---

const EscolheRestaurante = (props) => {
    
    const opcoes = props.restaurantes.map((opcao) => {
        return(<option key={opcao.idRestaurante} value={opcao.idRestaurante}>{opcao.nomeRestaurante}</option>)  
    })

    return (
        <select required className="form-select" onChange={props.idRestauranteEscolhido}>
            <option value="">Escolha um restaurante</option>
            {opcoes}
        </select>
    )
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<select required className="form-select" onChange={props.idRestauranteEscolhido}>
        <option value="">Escolha um restaurante</option>
        {
            props.restaurantes.map((opcao) => {
                return(
        <option key={opcao.idRestaurante} value={opcao.idRestaurante}>
            {opcao.nomeRestaurante}
        </option>
                ) 
    })
    }    
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!