React setState not updating state

前端 未结 9 772
慢半拍i
慢半拍i 2020-11-22 05:41

So I have this:

let total = newDealersDeckTotal.reduce(function(a, b) {
  return a + b;
},
0);

console.log(total, \'t         


        
9条回答
  •  时光取名叫无心
    2020-11-22 06:08

    just add componentDidUpdate(){} method in your code, and it will work. you can check the life cycle of react native here:

    https://images.app.goo.gl/BVRAi4ea2P4LchqJ8

提交回复
热议问题