0

I am trying to learn hooks and the useState method has made me confused. I am assigning an initial value to a state in the form of an array. The set method in useState is not working for me, both with and without the spread syntax.
I have made an API on another PC that I am calling and fetching the data which I want to set into the state.
Here is my code:



Neither setMovies(result) nor setMovies(…result) works.
I expect the result variable to be pushed into the movies array.

Kuldeep Baberwal Changed status to publish February 4, 2025