1 import React, { useState } from 'react';
2using useState:
3
4 const [val,setVal]=useState({})
5changin value on click of button
6
7 const handleClick = () => {
8 setVal(top100Films[0]);//you pass any value from the array of top100Films
9 // set value in TextField from dropdown list
10 };
11and pass this value to component in render
12
13 <Autocomplete
14 value={val}
15 options={top100Films}
16 getOptionLabel={option => option.title}
17 style={{ width: 300 }}
18 renderInput={params => (
19 <TextField
20 {...params}
21 label="Combo box"
22 variant="outlined"
23 fullWidth
24
25 />
26 )}
27 />