Why am I getting the error map is not a function

\\import React, { useState, useEffect } from 'react'

const  GetMovie = ()=> {
  const [movies, setMovie] = useState([])

  useEffect(() => {
      headers: ({
        "x-rapidapi-host": "movie-database-imdb-alternative.p.rapidapi.com",
        "x-rapidapi-key": "59b107254bmshc8d75c6cfb204d5p11148ejsnd3da153ac53e"
      .then(response => response.json())
      .then(response => {       
  return (
     {movies.map(item => (<li>{item}</li>))}

When I console.log movies I get an object but I can’t loop over it using map.

map is an array method, if movies is an object then you can’t use map

You are not set movie value like an array.

Example :


Thanks. That was the correct solution.