I'm trying to map across an array stored in props in my React component. The problem is that I keep getting an error stating that 'step is not defined', even when I have an array of steps defined such as below. Any thoughts on what I am doing incorrectly? Thanks in advance!
render() {
const protocol = this.props.protocol;
const steps = protocol.steps;
let stepList = null;
if (steps != null) {
stepList = <ul>
steps.map(
step => <li>{step.title}</li>
)
</ul>;
} else {
stepList = 'Do not display list';
}
return (
<div className="protocols-detail">
List of steps for {protocol.title}
{ stepList }
</div>
);
}
