import { createContext , FC , memo , PropsWithChildren , useContext } from "react" ; export const StateScope = memo ( ( { name , children } ) => { const path = useContext ( pathContext ) ?? "" ; return ( < pathContext . Provider value = { `${ path }/${ name }` } > { children } < /pathContext.Provider>); } ) ; export function useScopePath ( ) { return useContext ( pathContext ) ?? "/" ; } const pathContext = createContext < string | undefined > ( undefined ) ;