Skip to content
Discussion options

You must be logged in to vote

There's some difference but this might not be intuitive to some users:

  • With count={count}, the expression is treated as "static" therefore isn't wrapped into a getter and is never considered as reactive. With this in mind, props.count can be safely destructured without losing reactivity (since it wasn't there, in the first place).
  • With count={count()}, the expression is treated as "reactive" and is therefore wrapped into a getter. This, however, cannot be destructured outside of reactive scopes (e.g. createEffect) without losing reactivity.

Accessing their values (calling the signal prop vs accessing the reactive prop) should be the same however a "reactive prop" isn't always about sign…

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by yonathan06
Comment options

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

lxsmnsyc Dec 2, 2021
Collaborator

@yonathan06
Comment options

@atk
Comment options

Comment options

You must be logged in to vote
4 replies
@yonathan06
Comment options

@ryansolid
Comment options

@EnkeyMC
Comment options

@ryansolid
Comment options

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