Skip to content
Discussion options

You must be logged in to vote

When using prop destructuring for thingId, the compiler will rewrite uses of thingId to props.thingId. If something wouldn't work with props.thingId then it won't work with props destructuring either.

For example, with code like this:

getThingQuery(thingId)

The compiler will rewrite it to something like this:

getThingQuery(props.thingId)

Importantly, that is passing the current value of props.thingId to getThingQuery. If that value changes later, getThingQuery won't know anything about it.

As you noted, you can use computed to get around this problem when using props explicitly:

const t = computed(() => props.thingId)
getThingQuery(t)

That's fine, but computed comes with some extra intern…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eneeio-nm
Comment options

Answer selected by eneeio-nm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants