원클릭으로
optimize-react-component
Optimize React components for performance following Next.js 15 and project best practices
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Optimize React components for performance following Next.js 15 and project best practices
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Add a new Recharts visualization with theme-aware styling to the dashboard
Add a new metric card to the dashboard with proper styling and components
Add Lucide React icons to components following project conventions
Add responsive layouts following mobile-first design principles with Tailwind CSS
Add a new shadcn/ui component to the project following the New York style variant
Add or customize theme colors in the CSS custom properties system
| name | optimize-react-component |
| description | Optimize React components for performance following Next.js 15 and project best practices |
When optimizing React components in this Next.js 15 dashboard:
Choose the right component type:
Minimize client-side JavaScript:
// Good: Server Component (default)
export default function StaticContent() {
return <div>Content</div>;
}
// Use client only when necessary
"use client";
export default function InteractiveContent() {
const [state, setState] = useState(false);
return <div onClick={() => setState(!state)}>Content</div>;
}
Optimize re-renders with React.memo and useMemo:
import { memo, useMemo } from "react";
// Memoize expensive computations
const ExpensiveComponent = memo(function ExpensiveComponent({ data }) {
const processedData = useMemo(() => {
return data.map(item => expensiveOperation(item));
}, [data]);
return <div>{processedData}</div>;
});
Use dynamic imports for large components:
import dynamic from "next/dynamic";
const HeavyChart = dynamic(() => import("@/components/HeavyChart"), {
loading: () => <p>Loading chart...</p>,
ssr: false // Disable SSR if component uses browser APIs
});
Optimize images with next/image:
import Image from "next/image";
<Image
src="/image.png"
alt="Description"
width={500}
height={300}
priority // For above-the-fold images
/>
Prevent unnecessary effect executions:
// Include all dependencies
useEffect(() => {
fetchData(id);
}, [id]); // Specify dependencies
// Cleanup side effects
useEffect(() => {
const subscription = subscribe();
return () => subscription.unsubscribe();
}, []);
Type safety for better performance:
any typeComponent splitting:
Leverage Turbopack (Next.js 15):
npm run dev which automatically uses Turbopack// Before (unnecessarily client-side)
"use client";
export default function StaticCard() {
return <Card>Static Content</Card>;
}
// After (server component)
export default function StaticCard() {
return <Card>Static Content</Card>;
}
"use client";
import { memo, useMemo } from "react";
import { LineChart, Line } from "recharts";
export const OptimizedChart = memo(function OptimizedChart({ data }) {
const colors = useChartColors();
// Memoize processed data
const chartData = useMemo(() => {
return data.map(item => ({
name: item.label,
value: item.total
}));
}, [data]);
return (
<LineChart data={chartData}>
<Line dataKey="value" stroke={colors.chart1} />
</LineChart>
);
});
// Before: One large component
export default function Dashboard() {
return (
<div>
<Header />
<Stats />
<Charts />
<Footer />
</div>
);
}
// After: Split into smaller, focused components
export default function Dashboard() {
return (
<div>
<DashboardHeader />
<DashboardStats />
<DashboardCharts />
<DashboardFooter />
</div>
);
}
// Each component in its own file
// Easier to maintain, optimize, and test
next.config.tstsconfig.jsonsrc/components/DashboardCharts.tsxcreate-dashboard-pageadd-chart