Skip to content
Advertisement

How can I use useEffect and store an array in Reactnative?

I have data from redux called targetFarm. targetFarm.children contains these array object data.

JavaScript

I want to put data in targetFarm.children into gyetong using useEffect and setgyeTong hooks. As an array object value like below

JavaScript

But with my code it only takes one array.

JavaScript

How can i fix my code?

JavaScript

Advertisement

Answer

For your information, you cannot the expected answer of gyetong you mentioned. I assume from the code, you want to have an array of array containing single item.

You can instead of this, directly do this:

JavaScript

By default gyetong will have the values

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement