Examples · Islands on server HTML

JSON props

Big or nested data goes in a <script type="application/json"> inside the island.

Attributes are fine for a few scalars. For a list or a nested object the server inlines JSON next to the markup (Django's json_script, Rails json_escape) and the island reads it as props, without a request.

Playground

What to notice

  • The JSON block is inside the island, so an injected island elsewhere on the page cannot read it (S008).
  • Nothing is fetched: the data arrived with the HTML.
  • The same component could also receive data-aegis-props="#id" pointing at a sibling script.

Add a fourth row to the JSON in index.html; the table re-renders on the next run.