im new to React / Typescript. I just want to store the options that a user chose at the Autocomplete component. After that, i’d need to send the chosen values to an API. How do i do this?…
Code:
<Autocomplete multiple id="tags-roles" options={roles}
getOptionLabel={(option) => option.title}
renderInput={(params) => (
<TextField
{...params}
variant='standard'
label="Choose Roles"
placeholder='Roles'
/>
I already tried asking ChatGPT and seeing the Autocomplete doc on the MUI page but couldnt find anything
2
Answers
Allright i got the answere if others are looking for an answere in the future for this case:
Dig into the MUI Autocomplete docs and you will find examples, play with them and combine them and you will get code like this codesandbox
Basically, set up your state. Mutate as needed. Then when you are ready grab those values and send them to your API as needed.