

useEffect의 cleanup 함수에 있는 return 문에 화살표 함수는 return value가 있으면 안된다고 린트 오류가 뜬다. 이는 아래와 같이 if 문에 return undefined를 추가하면 해결이 된다.
React.useEffect(() => {
if (!api) {
return undefined;
}
onSelect(api);
api.on("reInit", onSelect);
api.on("select", onSelect);
return () => {
api?.off("select", onSelect);
};
}, [api, onSelect]);