A swc plugin that automatically converts React component libraries into "React Client Component". For example, you can automatically convert components from @mui into "React Client Component" without having to wrap a component that uses "use client".
npm:
npm install -D use-client
yarn:
yarn add -D use-client
pnpm:
pnpm i -D use-client
- include: ["@mui/material"]
next.js configuration:
const nextConfig = {
experimental: {
swcPlugins: [
[
"use-client",
{
include: ["@mui/material"],
},
],
],
},
};
swc configuration:
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"experimental": {
"plugins": [
["use-client", {
"include": ["@mui/material"]
}]
]
}
}
}