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

110
Views
Cómo pasar datos de la clase React.Component al archivo jsx

Tengo una clase con formulario y quiero pasar los datos ingresados al siguiente archivo jsx =>

Aquí está la clase ("remitente")

 import React from 'react' import Button from './Button'; class Sender extends React.Component { constructor() { super(); this.state = { imie: '', }; this.redirect = this.redirect.bind(this); this.handleChange = this.handleChange.bind(this); } handleChange({ target }) { this.setState({ [target.name]: target.value }); } getData(){ const sendData = [ { name: this.state.name } ] } render() { return ( <div className="order-wrapper"> <div className="order"> <div className="order-box"> <label htmlFor="name">Imie: </label> <input type="text" name="name" id="name" value={ this.state.name } onChange={ this.handleChange } /> </div> <div className="order-box"> <Button type="submit" value="Zamów" className="zamowbtn" onClick={this.redirect} /> </div> </div> </div> </div> ) } } export default Sender

Desde esta clase, quiero enviar el valor del name que se encuentra en la función getData() .

Necesito ese valor en el archivo .jsx a continuación y lo muestro en console.log(). ¿Cómo hacerlo? Por favor, ayúdame:)

 import React from 'react' import Sender from './Sender' const Finish = () => { return ( <div> { /* Here i need my 'name' value from Sender Class */ } </div> ) } export default Finish
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si hay diferentes partes de la aplicación y una no es padre de la segunda. Debe usar la API de contexto para esto

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!