I am curious about why use shallowReactive to deal with props #11327
Replies: 1 comment 1 reply
-
Disclaimer: I can only offer a probable explanation because your example code is a bit too short and incomplete. I.e.: what Likely, your problem is not related to Your problem is rooted in the fact that you destructure the props object. Which breaks reactivity for the destructured properties indirectly, because the new variable has no connection to the original object anymore - this is just Javascript. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If props changed,child component should be updated.I want to know more about that to solve a quesion I meet
I pass tableData which type is ref to child component
`
//parent component
const tableData = ref<OrderApi.OrderDetailList[]>([])
... later,tableData will receive data from remote interface
//child component
const props = defineProps < { tableData: OrderApi.OrderItem[] } > ()
const {tableData}=props
console.log(isProxy(tableData),'sss')
I print tableData ,find it is a proxy,and should be a reference of tableData of parent component ,Later I watch tableData in child component.when tableData gets remote data in parent component.The watch don't run,but It isn't a proxy ? I am in a mess🤔️
Beta Was this translation helpful? Give feedback.
All reactions