I'm trying to push a new component to an array that holds other equal components. My parent component is receiving that array from the server and renders it.
I logged this action and in the console, there is a new value but I don't see the new component on the screen.
Parent Component:
state = {
meetingsArr: [
{
id: 1,
metName: "driving lesson",
metTime: "45 min",
setTime: "10 min",
metCost: "100",
metInfo: "some text"
}
]
};
addMeetting = () => {
this.state.meetingsArr.push(<SingleMetting />);
console.log(this.state.meetingsArr);
};
render() {
const { meetingsArr } = this.state;
return (
<div>
{meetingsArr.map(item => (
<SingleMetting key={item.id} data={item} />
))}
<div className="new-met">
<button className="btn" onClick={this.addMeetting}>
create a new metting
</button>
</div>
</div>
);
}