Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. this.state = {
  2. productos: [],
  3. total:0,
  4. subtotal:0,
  5. productosSeleccionado:[]
  6. }
  7.  
  8. onclickAgregaProductos(data){
  9. const randomKey = Math.floor(Math.random() * 100) + 1;
  10. data.unique = randomKey;
  11. const newObject = [data, ...this.state.productosSeleccionado];
  12. //console.log(data);
  13. this.setState({ productosSeleccionado : newObject});
  14. //console.log(this.state.productosSeleccionado);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement