[TButtonTab] scrollTop 없을 시 예외처리

This commit is contained in:
hyunwoo93.cha
2024-02-21 10:23:42 +09:00
parent 206edb1235
commit 6d192d0edf

View File

@@ -39,15 +39,18 @@ export default function TButtonTab({
const onClick = useCallback(
(index) => (e) => {
if (onItemClick) {
if (selectedIndex === index) {
if (selectedIndex === index && scrollTop) {
return scrollTop();
}
onItemClick({ index, e });
scrollTop();
if (scrollTop) {
scrollTop();
}
}
},
[selectedIndex]
[selectedIndex, scrollTop]
);
return (