Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Created January 11, 2019 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniele-zurico/58f390762309a6608d15c52b9887657e to your computer and use it in GitHub Desktop.
Save daniele-zurico/58f390762309a6608d15c52b9887657e to your computer and use it in GitHub Desktop.
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