React issue with array

Hello, I tried to pass an array from one component to another one but when I do so, I get the message that todo.map is not a function even though I declared it to be an array in the parent element. Here’s the code

function Inputs({todo}){
    return(

        todo.map(todon => {return(
            <input className="singleItem" value={todon}></input>
        )})

    )
}

Inside the parent component, I used let [todo, setTodo] = useState([]) and then I passed it as a prop to my Inputs component as <Inputs todo={todo} />

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.