mirror of https://github.com/sveltejs/svelte
parent
23126c3078
commit
6568bcb226
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
import { getContext } from 'svelte';
|
||||
const value = getContext('foo');
|
||||
</script>
|
||||
|
||||
<div>Value in child component: {value}</div>
|
||||
@ -0,0 +1 @@
|
||||
<div><div>Value in child component: undefined</div></div>
|
||||
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import { setContext } from 'svelte';
|
||||
import ChildComponent from './ChildComponent.svelte';
|
||||
|
||||
setContext('foo', true);
|
||||
|
||||
const content = ChildComponent.render({}, { context: new Map() }).html;
|
||||
</script>
|
||||
|
||||
<div>{@html content}</div>
|
||||
Loading…
Reference in new issue