import React , { createContext , useState } from 'react' ; interface Context { activeTab : string ; setActiveTab ( activeTab ) : void ; } export const ActiveTabContext = createContext < Context > ( { activeTab : '' , setActiveTab : ( ) => null , } ) ; export const TabWrapper = ( props ) => { const [ openTab , setOpenTab ] = useState ( 'examples' ) ; const setTab = ( newTab ) => setOpenTab ( newTab ) ; return ( < ActiveTabContext . Provider value = { { activeTab : openTab , setActiveTab : setTab } } > { props . children } < /ActiveTabContext.Provider>); } ;