1. Styled Components의 재사용 방식


const PrimaryButton = styled.button`
  background: blue;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
`;

2. Tailwind의 재사용 방식


방법 A: 클래스 변수화

const primaryButtonClass = 'bg-blue-500 text-white py-3 px-6 rounded font-bold';

<butto className={primaryButtonClass}>Click</button>

방법 B: 컴포넌트로 추상화

function PrimaryButton({ children, ...props }) {
  return (
    <button className="bg-blue-500 text-white py-3 px-6 rounded font-bold" {...props}>
      {children}
    </button>
  );
}

방법 C: @apply를 사용한 CSS 추상화 (PostCSS)

/* button.module.css */
.primary {
  @apply bg-blue-500 text-white py-3 px-6 rounded font-bold; /* @apply */
}
import styles from './button.module.css';

<button className={styles.primary}>Click</button>