sveltejs / sapper-legacy.svelte.dev

Old docs site for Sapper
https://sapper-legacy.svelte.dev/
Other
13 stars 22 forks source link

add section on using non ssr-ready components #45

Closed antony closed 5 years ago

antony commented 6 years ago

Fixes #44

mindrones commented 5 years ago

I think it's not immediately clear how to use the component so I'd add something like:

async oncreate () {
  const MyComponent = await import("../path/to/MyComponent");
  this.set({MyComponent})
}

and mention that you use it as:

<svelte:component this={MyComponent}
  {prop1}
  prop2="foo"
/>