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

304
Views
cambiar los datos del consumidor de contexto no cambia los datos mostrados (Reaccionar)

Estoy implementando un carrito de compras, que obviamente tendrá un botón para agregar más productos. Implementé el contexto del carrito y la funcionalidad funciona bien, pero cuando aumento el número de productos para comprar, no cambia el número que se muestra. ¿Cuál podría ser mi problema?

Aquí está mi código para el consumidor de contexto.

 render() { return ( <CartContext.Consumer> { (cartContext =>{ const {addProduct} = cartContext return( <div> <h1 key={this.props.product.itemId}> {this.state.product.name} </h1> <button onClick={() => {addProduct(this.props.product.itemId)}}> Add </button> <h4>{this.props.product.qty}</h4> <hr/> </div> ) }) } </CartContext.Consumer> ) }
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!