import React, { useRef } from 'react'; const TabBar = ({ tabs, currentTab, setCurrentTab }) => { const tabsRef = useRef(null); const scrollBy = (x) => { const index = tabs.findIndex((tab) => tab.key === currentTab); tabsRef.current.scrollLeft += x; if (x < 0 && index > 0) { setCurrentTab(tabs[index - 1].key); } if (x > 0 && index < tabs.length - 1) { setCurrentTab(tabs[index + 1].key); } }; return (