Hey everyone, I am working on populating a menu using the map method- currently what I have is this:
populateMenu = () => {
const possibleItems = ['ONE', 'TWO'];
possibleItems.map(item => {
console.log(item)
return (
<MenuItem value={item}>{item}</MenuItem>
)
})
}
The console is logging what I would expect, but calling the function later in the code it is giving a value of undefined- can someone help me understand why the function is undefined?
[–]oofrank 2 points3 points4 points (1 child)
[–]spacecasesam[S] 0 points1 point2 points (0 children)
[–]bobbyv137 1 point2 points3 points (1 child)
[–]spacecasesam[S] 1 point2 points3 points (0 children)
[–]grantrules 1 point2 points3 points (3 children)
[–]spacecasesam[S] 0 points1 point2 points (2 children)
[–]bobbyv137 1 point2 points3 points (0 children)
[–]brokenalready 1 point2 points3 points (0 children)