若要使用內建的 CSS Modules 支援,請先確保您已在應用程式中設定 CSS 打包。
然後,您可以透過 .module.css
檔案命名慣例選擇加入 CSS Modules。 例如
.root {
border: solid 1px;
background: white;
color: #454545;
}
import styles from "./styles.module.css";
export const Button = React.forwardRef(
({ children, ...props }, ref) => {
return (
<button
{...props}
ref={ref}
className={styles.root}
/>
);
}
);
Button.displayName = "Button";