我创建了非常简单的自定义组件MuiMenu和MuiMenuItem. 但是当我显示这些组件时,我看到一个错误:
Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
Check the render method of `ForwardRef(Menu)`.
Run Code Online (Sandbox Code Playgroud)
但是如果我直接导入表单@material-ui/core- 一切都很好。如何解决?
工作示例:https : //codesandbox.io/s/sharp-shadow-bt404?file=/src/App.js
为什么不建议使用getInitialPropsinside_document.js进行静态渲染?为什么它可以破坏整个静态渲染呢?
比如我有几个案例:
对于电子商务,我需要构建项目并使用getStaticProps?
对于社交网络,我需要使用 SSR 和getServerSideProps?