Open firmart opened 1 week ago
Link to live example: link
Steps:
npm run dev
No error.
Use useAutocomplete to build a Search component. However, the example provided in the doc fails with Next.js.
useAutocomplete
Search
npx @mui/envinfo
Search keywords: useAutocomplete, next.js
The Search in your example should be defined as a client component. Adding 'use client'; at the top solves the issue.
'use client';
Steps to reproduce
Link to live example: link
Steps:
npm run dev
Current behavior
Expected behavior
No error.
Context
Use
useAutocomplete
to build aSearch
component. However, the example provided in the doc fails with Next.js.Your environment
``` 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 ```npx @mui/envinfo
Search keywords: useAutocomplete, next.js