Cookbook / Context Consumer

Context Consumer

container

consume() intrinsic — reads the 'theme' token provided by an ancestor context-provider.

id
context-consumer
since
0.5.0
file
context-consumer.aihu
consumeinterpolation

Run it

source · static

This recipe doesn't have a hydrated island in the demo gallery yet. An in-browser, WASM-compiled playground (edit this source and re-render live) is planned as a follow-up — read the real source below.

Source

context-consumer.aihu

Requires

concerns
state

Anti-patterns

  • Do not resolve context in module scope — consume() resolves against the ancestor chain at setup time, not import time.

Related recipes