0
good afternoon, I am going through difficulties to perform a conditional rendering that aims to render an Iconbutton only when and selected a value from the predefined list.
my const with the list
const [nomesRepresentantes, setNomesRepresentantes] = useState<
{ id: number; title: string }[]
>([]);
useEffect(() => {
setNomesRepresentantes([
{ id: 1, title: "João da silva" },
{ id: 2, title: "Joãozinho da silva" },
{ id: 3, title: "Maria da silva" },
{ id: 4, title: "José da silva" },
]);
}, []);
here is my autocomplete where I select the names
<Autocomplete
id="namesAutocomplete"
options={names.map((option) => option.title)}
freeSolo
value={representante.representante}
renderInput={(params) => (
<TextField {...params} variant="outlined" />
)}
/>
and this is the Iconbutton I need to render only when I select a value from my Autocomplete
<IconButton>
<OpenInNewSharpIcon
fontSize="default"
color="primary"
/>
</IconButton>
if necessary I can share all my component, thank you in advance for the help.
Thank you so much for your help friend!
– Arthur Prasniski