跳转到内容

NoSsr API

想要学习更多组件属性和 CSS API,可以查阅 React NoSsr 组件的 API 文档。

导入

import NoSsr from '@mui/base/NoSsr';
// 或
import { NoSsr } from '@mui/base';
你可以阅读这个关于最小化捆绑包的指南以了解以上二者的差异。

NoSsr purposely removes components from the subject of Server Side Rendering (SSR).

This component can be useful in a variety of situations:

  • Escape hatch for broken dependencies not supporting SSR.
  • Improve the time-to-first paint on the client by only rendering above the fold.
  • Reduce the rendering time on the server.
  • Under too heavy server load, you can turn on service degradation.

属性

名称类型默认值描述
childrennode
You can wrap a node.
deferboolfalse
If true, the component will not only prevent server-side rendering. It will also defer the rendering of the children into a different screen frame.
fallbacknodenull
The fallback content to display.

组件无法持有 ref。

演示项目