Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Created January 11, 2019 10:46
Embed
What would you like to do?
const TabSwitcher = ({ children }: any) => {
const [activeTabId, setActiveTab] = useState<string>("a");
const changeTab = (newTabId: any) => {
setActiveTab(newTabId);
};
return (
<context.Provider
value={{
activeTabId: activeTabId,
changeTab: changeTab
}}
>
{children}
</context.Provider>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment