next.js React Material UI Datapicker useSlotProps不是函数

lkaoscv7  于 2023-04-05  发布在  React
关注(0)|答案(1)|浏览(165)

I have been unable to reproduce this error on codesandbox and also find any other information on it online. My package.json is exactly the same as that on the official example: https://codesandbox.io/s/0qou17
TypeError: (0 , _utils.useSlotProps) is not a function (projectsouce\node_modules@mui\x-date-pickers\node\internals\hooks\useDesktopPicker\useDesktopPicker.js:74:49) at Object.DesktopDatePicker [as render] (projectsouce\node_modules@mui\x-date-pickers\node\DesktopDatePicker\DesktopDatePicker.js:54:46) at ReactDOMServerRenderer.render (projectsouce\node_modules\react-dom\cjs\react-dom-server.node.development.js:3872:44) at ReactDOMServerRenderer.read (projectsouce\node_modules\react-dom\cjs\react-dom-server.node.development.js:3690:29) at Object.renderToString (projectsouce\node_modules\react-dom\cjs\react-dom-server.node.development.js:4298:27) at renderPage (projectsouce\node_modules\next\dist\server\render.js:680:46) at Object.ctx.renderPage (webpack-internal:///./src/pages/_document.js:85:26) at Object.defaultGetInitialProps (projectsouce\node_modules\next\dist\server\render.js:350:67) at Function.getInitialProps (webpack-internal:///./node_modules/next/dist/pages/_document.js:19:20) at Function.MyDocument.getInitialProps (webpack-internal:///./src/pages/_document.js:97:85)

import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";

export default function PropertyInfoTab(props) {
return (
    <LocalizationProvider dateAdapter={AdapterDayjs}>
        <DatePicker />
    </LocalizationProvider>
);
}

Package JSON:

{
"name": "my-divjoy-project",
"version": "0.1.0",
"private": true,
"keywords": [
  "divjoy"
],
"dependencies": {
  "@analytics/google-analytics": "^1.0.5",
  "@emotion/cache": "latest",
  "@emotion/react": "^11.10.6",
  "@emotion/server": "latest",
  "@emotion/styled": "^11.10.6",
  "@mui/icons-material": "5.8.0",
  "@mui/lab": "5.0.0-alpha.83",
  "@mui/material": "^5.11.14",
  "@mui/styles": "5.8.0",
  "@mui/x-data-grid": "^5.17.25",
  "@mui/x-data-grid-generator": "^6.0.0",
  "@mui/x-data-grid-pro": "^6.0.0",
  "@mui/x-date-pickers": "^6.0.3",
  "@stripe/stripe-js": "1.11.0",
  "analytics": "0.3.1",
  "date-fns": "^2.29.3",
  "dayjs": "^1.11.7",
  "firebase": "^9.18.0",
  "firebase-admin": "^11.5.0",
  "mailchimp-api-v3": "1.14.0",
  "next": "^12.3.4",
  "path-parser": "6.1.0",
  "query-string": "6.13.8",
  "raw-body": "2.4.1",
  "react": "18.2.0",
  "react-dom": "18.2.0",
  "react-hook-form": "6.15.1",
  "react-query": "3.32.1",
  "stripe": "8.132.0",
  "typescript": "^4.9.5",
  "use-local-storage-state": "9.0.2"
},
"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "stripe-webhook": "stripe listen --forward-to localhost:3000/api/stripe-webhook"
},
"devDependencies": {
  "jest": "^29.5.0"
}

}

egdjgwm8

egdjgwm81#

useSlotProps是从**@mui/base/utils**导入的,可能需要安装@mui/base才能使用。

相关问题