Skip to content

Instantly share code, notes, and snippets.

@ShopifyEng
Created November 30, 2021 21:34
Show Gist options
  • Save ShopifyEng/7cf24489f098ed973f1ae0f270bc2634 to your computer and use it in GitHub Desktop.
Save ShopifyEng/7cf24489f098ed973f1ae0f270bc2634 to your computer and use it in GitHub Desktop.
Remote Rendering: Shopify’s Take on Extensible UI - Basic example setting up a `RemoteReceiver` to work together with a `RemoteRoot`
// Extension
import { createEndpoint } from "@remote-ui/rpc";
import { createRemoteRoot } from "@remote-ui/core";
function render(remoteChannel) {
const root = createRemoteRoot(remoteChannel);
root.appendChild(root.createText("Hello World!"));
root.appendChild(root.createComponent("LineBreak"));
root.mount();
}
createEndpoint(self).expose({ render });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment