Компонент:
Код: Выделить всё
const checkBoxRef = useRef({});
useEffect(() => {
console.log(checkBoxRef.current)
Object.entries(checkBoxRef.current).forEach(([_, el]) => {
if (el) el.addEventListener("change", () => {});
});
}, [fields]);
{ checkBoxRef.current[index] = el; }}
checked={fieldItem.value === "Yes"}
/>
< /code>
mock: < /p>
jest.mock("external-checkbox-library", () => ({
Checkbox: React.forwardRef(({ checked, ...props }, ref) => (
)),
}));
Подробнее здесь: https://stackoverflow.com/questions/795 ... eckbox-wit
Мобильная версия