v0.20.230 - 15.1 / 6.1

Context

Context carries values through the reactive scope so deeply nested components can read them without prop drilling. A single function acts as both the provider and the reader.

# Signature

context(defaultValue?) returns a function. Call it with no argument to read the current value (or the default if nothing was provided). Call it with a value and a fn to push that value for the duration of fn — children rendered inside read the new value; everything outside keeps the previous one. Providing a Partial of an object value shallow-merges it with the inherited value.

# Snippet

# Example

Using and testing context

# Another Test