Files
component-party/content/4-component-composition/5-context/svelte/App.svelte
2023-01-08 16:30:32 +01:00

17 lines
365 B
Svelte

<script>
import { setContext } from "svelte";
import UserProfile from "./UserProfile.svelte";
import createUserContext from "./createUserContext.js";
// In a real app, you would fetch the user data from an API
setContext(
"user",
createUserContext({
username: "john",
email: "john@example.com",
})
);
</script>
<UserProfile />