Skip to content

Commit

Permalink
content: Changes for content Vue
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailassa committed Feb 9, 2023
1 parent 30fc360 commit 025365c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion content/4-component-composition/5-context/vue3/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function updateUsername(username) {
user.value.username = username;
}
provide("userContextProvider", { user, updateUsername });
provide("user", { user, updateUsername });
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script setup>
import { inject } from "vue";
const { user, updateUsername } = inject("userContextProvider");
const { user, updateUsername } = inject("user");
</script>

<template>
<div>
<h2>My Profile</h2>
<p>Username: {{ user.username }}</p>
<p>Email: {{ user.email }}</p>
<button @click="updateUsername('Jane')">
<button @click="() => updateUsername('Jane')">
Update username to Jane
</button>
</div>
Expand Down

0 comments on commit 025365c

Please sign in to comment.