I want to display all months in dropdown using react js. Below is my code .I have used moments to fetch all 12 months. I am getting value in console but not in my dropdown.
To display the dropdown values want to use the . I have used that also. I don't know where I went wrong. Could any one can help me with this? Thanks in advance.
const fareMon = () => {
const months = [];
const monthList = moment.months();
months.push(<option value={monthList} />);
console.log('MONTHS123', monthList);
return months;
};
return (
<div className={styles.formClm2}>
<Form.Group className={styles.formGroup}>
<Form.Label>{t('PaymentPage.lblExpiry')}</Form.Label>
<div className="double">
<Form.Control required as="select" name="startDate">
<option value="">Months</option>
{fareMon()}
</Form.Control>
</div>
</Form.Group>
</div> )