# React issue - this.setState is not updating initial state prop which is an array

**URL:** <https://forum.freecodecamp.org/t/react-issue-this-setstate-is-not-updating-initial-state-prop-which-is-an-array/384141>\
**Category:** General\
**Created:** [May 5, 2020, 3:13pm UTC](https://forum.freecodecamp.org/t/react-issue-this-setstate-is-not-updating-initial-state-prop-which-is-an-array/384141 "2020-05-05T15:13:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NiSofwareEngineer](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nisofwareengineer/32/423942_2.png) [@NiSofwareEngineer](https://forum.freecodecamp.org/u/NiSofwareEngineer)\
**Post date:** [May 5, 2020, 3:13pm UTC](https://forum.freecodecamp.org/t/react-issue-this-setstate-is-not-updating-initial-state-prop-which-is-an-array/384141/1 "2020-05-05T15:13:23Z")

</div>

Hi all

Thanks to FCC and hard work, i am now a junior dev.

i lost my job due to discrimination however. Despite this, i am not giving up.

> <https://stackoverflow.com/questions/61616007/this-setstate-is-not-updating-an-initialised-state-property-which-is-an-array-d>

This is a problem i am currently working on.

If anyone can please review the above link and get back to me with their thoughts it would be greatly appreciated.

Remember all, never give up!

---

<div class="post-metadata">

**Author:** ![NiSofwareEngineer](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nisofwareengineer/32/423942_2.png) [@NiSofwareEngineer](https://forum.freecodecamp.org/u/NiSofwareEngineer)\
**Post date:** [May 5, 2020, 4:23pm UTC](https://forum.freecodecamp.org/t/react-issue-this-setstate-is-not-updating-initial-state-prop-which-is-an-array/384141/2 "2020-05-05T16:23:21Z")

</div>

The issue was object destructuring…

Using const {items] = response;

Fixes this.

Will leave this here just in case anyone else comes across similar problem in future.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:55pm UTC](https://forum.freecodecamp.org/t/react-issue-this-setstate-is-not-updating-initial-state-prop-which-is-an-array/384141/3 "2021-06-01T18:55:38Z")

</div>

Closed on June 1, 2021, 6:55pm UTC


