ThugDev / PurrTunes

고양이가 ν‹€μ–΄μ£ΌλŠ” 랜덀 μŒμ•… μž¬μƒ μ‚¬μ΄νŠΈ
https://purr-tunes.vercel.app/
0 stars 2 forks source link

how to use : lucide-react #5

Closed 55555-Jyeon closed 2 months ago

55555-Jyeon commented 3 months ago

πŸ”— lucide website

⬇️ install : npm install lucide-react



import dynamic from 'next/dynamic'
import { LucideProps } from 'lucide-react';
import dynamicIconImports from 'lucide-react/dynamicIconImports';

interface IconProps extends LucideProps {
  name: keyof typeof dynamicIconImports;
}

const Icon = ({ name, ...props }: IconProps) => {
  const LucideIcon = dynamic(dynamicIconImports[name])

  return <LucideIcon {...props} />;
};

export default Icon;