Getting the value in the React material-UI Autocomplete

后端 未结 1 1181
北荒
北荒 2021-01-03 20:23

I am referring to the documentation of React Material-UI (https://material-ui.com/components/autocomplete/).

In the demo code,

    

        
相关标签:
1条回答
  • 2021-01-03 20:35

    Solved by using passing in the (event, value) to the onChange props.

    <Autocomplete
        onChange={(event, value) => console.log(value)} // prints the selected value
        renderInput={params => (
            <TextField {...params} label="Label" variant="outlined" fullWidth />
        )}
    />
    
    0 讨论(0)
提交回复
热议问题