Context
Types
Context type
luau
type Context<T> = {
default: T,
_current: T,
get: (self: Context<T>) -> T,
provide: <R>(self: Context<T>, value: T, fn: () -> R) -> R,
}Functions
new
luau
Context.new<T>(default: T): Context<T>Creates a dynamically-scoped value with the given default, read by any code running under a provide without threading it through arguments. Outside any active provide, reads return default. Pair with components to share theme, services, or the current user down a tree.