TutorialsA design system under constraint

React context does not cross an island boundary

Composing a compound component inside a .astro file breaks the build; the assembly has to live on the React side.

IntermediateArticle4 steps9 min

A compound component — accordion, popover, tabs — shares its state through React context. Written in a .astro file, with the hydration directive on the root, it throws at build time: the parts cannot find their root’s context.

1. See what a directive bounds

client:load does not make the page reactive: it declares one island, whose root is the component carrying the directive. Children written in the .astro file are rendered by Astro, at build time, outside that React tree. They therefore descend from no context provider — there is no shared tree in which to look for one.

2. Assemble on the React side

The assembly goes into a single .tsx file: the root and its parts form one React tree there, and that file is what carries the directive. The page now sees a single component.

3. Pass serialisable data only

An island’s props cross the boundary as JSON. An array of {label, value} objects gets through; a render function does not. The constraint is welcome: it pushes assembly into the React file and data into the page.

4. Refuse the island when a native element suffices

The converse rule matters just as much. A panel that opens and closes is a <details>: it needs no script, stays in the delivered HTML, and prints expanded. A popover, by contrast, positions itself, closes on an outside click and announces its state — three behaviours no native element provides. You pay for a React root with a behaviour, never with uniformity.

Talk to the Discovery AgentOpen in full
Command

Agent

Talk to the Discovery AgentFrame your project in eight questions.

Act

Dark themePin the site's appearance
Light themePin the site's appearance
System themeFollow the system preference again
Switch the site to FrenchFrançais
Labs — ProductFilter Labs by type
Labs — PrototypeFilter Labs by type
Labs — ResearchFilter Labs by type
Labs — Reset filtersClear every Labs filter
Journal — EngineeringFilter the Journal by category
Journal — SecurityFilter the Journal by category
Journal — Agent-NativeFilter the Journal by category
Journal — StudioFilter the Journal by category
Journal — Reset filtersClear every Journal filter
Tutorials — BeginnerFilter tutorials by level
Tutorials — IntermediateFilter tutorials by level
Tutorials — AdvancedFilter tutorials by level
Tutorials — Reset filtersClear every tutorials filter

Services

DiscoveryFrame the product before the first line of code, so the budget builds instead of correcting.
Product designAn interface that holds together, carried by a design system your developers can keep alive without us.
Web developmentA fast web application that holds up over time, with the tests and delivery chain to match.
Mobile developmentAn iOS and Android app from a single codebase, published on both stores.
Infrastructure & securityInfrastructure described as code, and Zero Trust access that does not rest on a text message.
Maintenance & evolutionA product kept current, watched and fixed, with someone who answers when it breaks.
Agent-Native Architecture AdvisoryMake an existing product agent-operable without rewriting it — and without opening more than it should.

Go to

YorroProduct engineering studio in Abidjan and Paris. We design, we build, we ship.
ServicesBuild a product end to end, or advise a team on its agent-native architecture.
LabsWhat the studio has built: products, prototypes and research, with where each one actually stands.
TutorialsStep-by-step guides drawn from real projects, grouped into tracks by topic.
JournalThe studio's notes and positions.
ContactDescribe your project; you get a framing back, not a boilerplate quote.
AboutWho runs the studio, how it works, and what it turns down.
Discovery AgentDescribe your project in conversation; the agent ticks the modules and produces an indicative estimate.

↑↓move↵runescclose