Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function UseAutocomplete() {
const classes = useStyles();
const {
getRootProps,
getInputLabelProps,
getInputProps,
getListboxProps,
getOptionProps,
groupedOptions,
} = useAutocomplete({
id: 'use-autocomplete-demo',
options: top100Films,
getOptionLabel: option => option.title,
});
return (
<div>
<div>
<label>
useAutocomplete
</label>
<input>
</div>
{groupedOptions.length > 0 ? (
<ul>
{groupedOptions.map((option, index) => (</ul></div>
export default function CustomizedHook() {
const {
getRootProps,
getInputLabelProps,
getInputProps,
getTagProps,
getListboxProps,
getOptionProps,
groupedOptions,
value,
focused,
setAnchorEl,
} = useAutocomplete({
id: 'customized-hook-demo',
defaultValue: [top100Films[1]],
multiple: true,
options: top100Films,
getOptionLabel: option => option.title,
});
return (
<div>
<div>
<label>Customized hook</label>
{value.map((option: FilmOptionType, index: number) => (
))}
<input></div></div>
export default function UseAutocomplete() {
const classes = useStyles();
const {
getRootProps,
getInputLabelProps,
getInputProps,
getListboxProps,
getOptionProps,
groupedOptions,
} = useAutocomplete({
id: 'use-autocomplete-demo',
options: top100Films,
getOptionLabel: option => option.title,
});
return (
<div>
<div>
<label>
useAutocomplete
</label>
<input>
</div>
{groupedOptions.length > 0 ? (
<ul>
{groupedOptions.map((option, index) => (</ul></div>
export default function CustomizedHook() {
const {
getRootProps,
getInputLabelProps,
getInputProps,
getTagProps,
getListboxProps,
getOptionProps,
groupedOptions,
value,
focused,
setAnchorEl,
} = useAutocomplete({
id: 'customized-hook-demo',
defaultValue: [top100Films[1]],
multiple: true,
options: top100Films,
getOptionLabel: option => option.title,
});
return (
<div>
<div>
<label>Customized hook</label>
{value.map((option, index) => (
))}
</div></div>