Module

Solid.Context

Package
purescript-purs-solid
Repository
arazorda/purs-solid

Context: values provided to a subtree. Every context has a default; for one that must be provided, use Context (Maybe a) with default Nothing.

#Context Source

data Context t0

#createContext Source

createContext :: forall a. String -> a -> Context a

The name identifies the context: every createContext with the same name is the same context (the first default wins), so define it once at the top level under a qualified name, e.g. createContext "App.theme" Light. It also shows in Solid's dev diagnostics.

#useContext Source

useContext :: forall a. Context a -> Setup a

The nearest provided value, or the context's default.

#provide Source

provide :: forall a. Context a -> a -> Setup JSX -> JSX