mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 22:39:41 +02:00
16 lines
364 B
TypeScript
16 lines
364 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
export const InputContext = createContext<{
|
|
allowAuto: boolean;
|
|
allowBindMounts: boolean;
|
|
} | null>(null);
|
|
|
|
export function useInputContext() {
|
|
const value = useContext(InputContext);
|
|
|
|
if (value === null) {
|
|
throw new Error('useContext must be used within a Context.Provider');
|
|
}
|
|
|
|
return value;
|
|
}
|