Skip to content

There appears to be no responsive data in the component's props #109

Answered by Fry98
dongwa asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, when you pass in a primitive value as a prop, it will indeed not be reactive. You are supposed to be passing the initial state of a component, not a reactive one. Note however that if you changed the counter property to be an object, it would actually remain reactive in the child component (code: https://codepen.io/fry98/pen/ExwZPyQ).

This behavior is not a bug but one way to work around it is to pass reactive props as lambda functions for which you can set up getters inside the child component (example: https://codepen.io/fry98/pen/JjrEGbB).

Be aware that this is pretty much always unnecessary though because both the parent's state and your reactive() store are accessible from withi…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@dongwa
Comment options

Comment options

You must be logged in to vote
1 reply
@dongwa
Comment options

Comment options

You must be logged in to vote
3 replies
@dongwa
Comment options

@Fry98
Comment options

@dongwa
Comment options

Answer selected by dongwa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants