()
| 744 | const [selectedTabId, setSelectedTabId] = useState(tabs[0].id); |
| 745 | |
| 746 | let addTab = () => { |
| 747 | const tabId = tabs.length + 1; |
| 748 | |
| 749 | setTabs(prevTabs => [ |
| 750 | ...prevTabs, |
| 751 | { |
| 752 | id: tabId, |
| 753 | title: `Tab ${tabId}`, |
| 754 | content: `Tab body ${tabId}` |
| 755 | } |
| 756 | ]); |
| 757 | |
| 758 | // Use functional update to ensure you're working with the most recent state |
| 759 | setSelectedTabId(tabId); |
| 760 | }; |
| 761 | |
| 762 | let removeTab = () => { |
| 763 | if (tabs.length > 1) { |
nothing calls this directly
no outgoing calls
no test coverage detected