Skip to content
Advertisement

Tag: react-hooks

How to assign fetched data to React state

I trying to fetch data of an object (in this example from https://api.themoviedb.org/3/movie/459151?api_key=f13446aa3541ebd88cf65b91f6932c5b) and I’m trying to assign it to state movie. However, when I console it out, it has value undefined (actually, it is consoled out twice, firstly with default values of state and secondly as undefined). How to solve it? Thanks Answer As it seems in the API

How to replace Array in useState?

I want make program that table content is changed by user’s select. So I put empty array in useState, like this. And select html code: When I select option, data will be changed. But I don’t no how to do it with useState. These are data And my React code: I tried using map. But I don’t know how to

Advertisement