P.Bjur
P.Bjur

Reputation: 79

Why am I getting "Cannot read properties of undefined (reading 'hasOwnProperty')" for an Autocomplete component

I am using the Autocomplete MUI component in a Preact app using Preact-cli. When I click into the textfield of the autocomplete component I get the following error.

Failed prop type: Cannot read properties of undefined (reading 'hasOwnProperty')
  in ForwardRef()
  in ForwardRef()
  in MuiPopperRoot
  in ForwardRef()
  in MuiAutocompletePopper
  in ForwardRef() (at /Users/name/code/parlibre/src/components/app.js:23)

I am using the following Autocomplete component for testing purposes.

<Autocomplete
   id="autocomplete"
   options={['1', '2', '3']}
   renderInput={(params) => <TextField {...params} label="autocomplete" />}
/>

This problem occurs when I build and serve using:

npm run build
npm run serve

but does not occur when I run it in a dev environment using: npm run dev

Upvotes: 0

Views: 530

Answers (0)

Related Questions