I'm attempting to build a Select dropdown and populate the input fields using a for loop.
import React, { Component } from 'react';
export default class Test extends Component {
render() {
let options = [];
for (let i=2; i < 20.5; i += 0.5){
options.push(<option value={i*60} key={i}>{i} hours</option>)
}
return (
<select>
{options}
</select>
)
}
}
The {i} hours section causes an Uncaught TypeError: Cannot read property 'props' of undefined error message. Changing it to a fixed string prevents the error.
I'm sure I'm missing something basic but I have no idea why this isn't working.