contexts.SubmitContext.tsx Maven / Gradle / Ivy
import { createContext, useState } from 'react';
import { SetState } from 'types/react';
export interface SubmitProps {
setSubmitting: SetState,
submitting: boolean,
}
export interface SubmitProvidedProps {
children: React.ReactNode,
}
export const SubmitContext = createContext({
submitting: false,
setSubmitting: () => { console.error("Submit context provider is not initialized") }
})
const SubmitProvider = ({children}: SubmitProvidedProps) => {
const [submitting, setSubmitting] = useState(false)
return (
{children}
)
}
export default SubmitProvider