Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Created January 11, 2019 10:49
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/108cc245335781444f53946609c89244 to your computer and use it in GitHub Desktop.
Save daniele-zurico/108cc245335781444f53946609c89244 to your computer and use it in GitHub Desktop.
const Tab = ({ id, children }: any) => {
const tab = useContext(context);
return <div onClick={() => tab.changeTab(id)}>{children}</div>;
};
const TabPanel = ({ whenActive, children }: any) => {
const tab = useContext(context);
return tab.activeTabId === whenActive ? children : null;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment