import React, { useState, useEffect } from 'react' import Box from '@mui/material/Box' import TextField from '@mui/material/TextField' const SelectTextFields = (props) => { const [currency, setCurrency] = useState(props.textBoxFieldSelected ? props.textBoxFieldSelected : '0') if (!props.textBoxFieldSelected) { props.currencies.push({ 'value': 0, 'label': '' }) } if(props.textBoxFieldSelected === 'All'){ const already = props.currencies.findIndex(obj => obj.value === 'All'); if (already === -1) { props.currencies.push({ 'value': 'All', 'label': 'All' }) } } useEffect(() => { props.func(currency) }, [currency, props.textBoxFieldSelected]) const handleChange = (event) => { setCurrency(event.target.value) } return ( {props.currencies.map((option, index) => ( {option.label} ))} ) } export default SelectTextFields /* return ( {currencies.map((option) => ( {option.label} ))} {currencies.map((option) => ( {option.label} ))} {currencies.map((option) => ( {option.label} ))} {currencies.map((option) => ( {option.label} ))} {currencies.map((option) => ( {option.label} ))} {currencies.map((option) => ( {option.label} ))} ); */