i want to render a component if some condition is true and loop through that prop array.
Below is what i want to do
render() {
return (
{first_condition &&
<div>some text</div>}
{this.props.some_vars &&
this.props.some_vars.forEach((var, index) => {
this.box_ref.current && var.name &&
<ChildComponent
element1={var.element1}
element2={var.element2}
/>
}//error here
);
}
But the code gives me an error at the curly bracket...how should i render this childcomponent based on that condition. Thanks.