Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
709 B

import { createContext, useState, ReactNode } from 'react';
interface AnvilContextType {
uuid: string;
setAnvilUuid: (uuid: string) => void;
}
const AnvilContextDefault: AnvilContextType = {
uuid: '',
setAnvilUuid: () => null,
};
const AnvilContext = createContext<AnvilContextType>(AnvilContextDefault);
const AnvilProvider = ({ children }: { children: ReactNode }): JSX.Element => {
const [uuid, setUuid] = useState<string>('');
const setAnvilUuid = (anvilUuid: string): void => {
setUuid(anvilUuid);
};
return (
<AnvilContext.Provider value={{ uuid, setAnvilUuid }}>
{children}
</AnvilContext.Provider>
);
};
export default AnvilProvider;
export { AnvilContext };