[TIL/React] clsx로 조건부 className 쉽게 사용하기
clsx는 왜쓰나?
요즘 유행하는 tailwind css를 활용할 때, className을 조건에 따라서 분기하는 경우가 많다. 나는 현재 회사 프로젝트에서 다음과 같이 className을 조건에 따라 분기하여 활용했다.
interface AnswerButtonProps {
label: string;
isSelected: boolean;
handleTap: () => void;
}
export function Answe...
studio-pendant.hashnode.dev3 min read