库 React Material UI 的排版中的变体与组件有什么区别

use*_*835 6 reactjs react-material

我正在使用 React Material UI 组件。Typography 组件有 2 个 props,variant 和 component。这些 props 有什么区别。

BeH*_*ppy 7

某些预定义样式可以与变体一起使用,但要呈现的最终 HTML 元素可以使用组件设置。例如,您可以使用variant="body1"withcomponent="h2"variant="body2"withcomponent="h2"具有较小字体大小的字体。