Answer the question
In order to leave comments, you need to log in
Why doesn't .includes check for the existence of an array?
Hello, I can't figure out why I'm getting all elements "disabled" (using either classNames).
const typeNames = ['settings1', 'settings2'];
const [activeType, setActiveType] = useState(0);
const onSelectType = (index) => {
setActiveType(index)
}
className={classNames("item_settings",{ active: activeType === index && types.includes(index), disabled: !types.includes(index)})}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question