Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Autocomplete] Error: (0 , _mui_base_useAutocomplete__WEBPACK_IMPORTED_MODULE_2__.useAutocomplete) is not a function #727

Open
firmart opened this issue Oct 9, 2024 · 1 comment
Assignees
Labels
component: autocomplete This is the name of the generic UI component, not the React module! package: @mui/base (legacy)

Comments

@firmart
Copy link

firmart commented Oct 9, 2024

Steps to reproduce

Link to live example: link

Steps:

  1. npm run dev

Current behavior

image

Expected behavior

No error.

Context

Use useAutocomplete to build a Search component. However, the example provided in the doc fails with Next.js.

Your environment

npx @mui/envinfo
 Browser : Chrome

  Output from `npx @mui/envinfo` goes here.

  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
  Binaries:
    Node: 21.6.2 - ~/.nvm/versions/node/v21.6.2/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v21.6.2/bin/npm
    pnpm: 8.15.4 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 123.0.6312.105
  npmPackages:
    @mui/base: 5.0.0-beta.58 => 5.0.0-beta.58
    @types/react: ^18.3.5 => 18.3.5
    react: ^18.3.1 => 18.3.1
    react-dom: ^18.3.1 => 18.3.1
    typescript: ^5.6.2 => 5.6.2


Search keywords: useAutocomplete, next.js

@firmart firmart added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 9, 2024
@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Oct 9, 2024
@michaldudak
Copy link
Member

The Search in your example should be defined as a client component. Adding 'use client'; at the top solves the issue.

@michaldudak michaldudak added package: @mui/base (legacy) and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! package: @mui/base (legacy)
Projects
None yet
Development

No branches or pull requests

4 participants