I am making a sorting algo visualizer and i am getting this error(Cannot read properties of undefined (reading 'map')) in line let bars = this.state.array.map((value, index) => here is my code. The whole code at below link error at line(165) : https://codebeautify.org/alleditor/y220e1b19
Thanks in Advance
render() {
let bars = this.state.array.map((value, index) =>
// console.log(`The ${index} is ${ceo}`);
{
return (
<Bar
key={index}
index={index}
length={value}
color={this.state.colorKey[index]}
changeArray={this.changeArray}
/>
);
});
Should render be define as?
Render = () => {
}
If above doesn't help have you put a break point to see which part of
this.state.array.map((value, index) =>
is undefined?