From 6266406da69621da5757714b1300178b39e8c01b Mon Sep 17 00:00:00 2001 From: zhiyuanzmj <32807958+zhiyuanzmj@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:00:43 +0800 Subject: [PATCH] Update README.md --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7998e61..2f08dae 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ npm i unplugin-vue-jsx-vapor ``` > [!CAUTION] -> The destructuring of props in a functional component will cause loss of reactivity. +> ❌ The destructuring of props in a functional component will cause loss of reactivity. ```tsx function Comp({ foo }) { @@ -24,9 +24,9 @@ const foo = ref('foo') export default ``` -#### Solutions +#### Two Solutions -1. Pass a ref variable as prop: +1. ✅ Pass a ref variable as prop: ```tsx function Comp({ foo }) { @@ -37,7 +37,7 @@ const foo = ref('foo') export default ``` -2. Turn on the restructure option to restructure props. +2. ✅ Turn on the restructure option to restructure props. ```ts // vite.config.ts @@ -58,6 +58,9 @@ function Comp({ foo }) { function Comp(_ctx0) { return
{_ctx0.foo}
} + +const foo = ref('foo') +export default ```