I don't know why, but array method called name is not working for me. I used map method before, always worked properly...
I was searching for something on internet, tried to add keys or change the value from jsx to just normal text, nothing worked, I added some console.log in callback function, it worked, it looks like the return statement is not working
import React from 'react';
import AddBar from '../AddBar/AddBar'
const thingsToBuy = ["sandwich", "mango", "banana", "watermelon"];
class List extends React.Component {
render() {
thingsToBuy.map((thing, i) => {
console.log(thingsToBuy);
return <li key={i}>{thing}</li>
})
return (
<div>
<ol>
{thingsToBuy}
</ol>
<AddBar />
</div>
)
}
}
The output should be an array of React components like this: [li.../li, li.../li, li.../li], now it's just original array without any errors in console.