1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-10-16 06:57:26 +00:00

Create a provider for the EditingContext

This commit is contained in:
Steffo 2022-07-18 06:09:17 +02:00
parent cef886a4ef
commit 9732f938b5
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -0,0 +1,14 @@
import { ReactNode, useState } from "react"
import { EditingContext, EditingMode } from "./base"
/**
* Component which stores the current editing mode (by default {@link EditingMode.VIEW}) using {@link useState} and provides it to its children through an {@link EditingContext}.
*/
export const EditingModeProvider = ({ children }: { children: ReactNode }) => {
return (
<EditingContext.Provider value={useState<EditingMode>(EditingMode.VIEW)}>
{children}
</EditingContext.Provider>
)
}