Skip to content

Instantly share code, notes, and snippets.

@ShopifyEng
Created Nov 30, 2021
Embed
What would you like to do?
Remote Rendering: Shopify’s Take on Extensible UI - Basic example setting up a `RemoteReceiver` to work together with a `RemoteRoot`
// Host
import { createEndpoint } from "@remote-ui/rpc";
import { createRemoteReceiver } from "@remote-ui/core";
const endpoint = createEndpoint(new Worker("./extension.js"));
const receiver = createRemoteReceiver();
receiver.on("mount", () => {
const remoteRoot = receiver.attached.root;
// Render the remote tree using native UI components ...
});
endpoint.call.render(receiver.receive);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment