D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
correlations
/
Forms
/
Filename :
correlationsFormContext.tsx
back
Copy
import React, { createContext, PropsWithChildren, useContext } from 'react'; import { Correlation } from '../types'; export type CorrelationsFormContextData = { loading: boolean; correlation?: Correlation; readOnly: boolean; }; export const CorrelationsFormContext = createContext<CorrelationsFormContextData>({ loading: false, correlation: undefined, readOnly: false, }); type Props = { data: CorrelationsFormContextData; }; export const CorrelationsFormContextProvider = (props: PropsWithChildren<Props>) => { const { data, children } = props; return <CorrelationsFormContext.Provider value={data}>{children}</CorrelationsFormContext.Provider>; }; export const useCorrelationsFormContext = () => { return useContext(CorrelationsFormContext); };