Skip to content

accessing this.prop if not defined on x-data will lead to global var #4505

Answered by SimoTod
robkuz asked this question in 1. Help
Discussion options

You must be logged in to vote

Do you have an example to replicate. It works as expected for me: https://codepen.io/SimoTod/pen/yyBRgRV
In general, it's better to always set a default empty state for your variable as there could be a directive trying to access your variable before init finishes (for example, it's waiting for a promise to resolve or similar cases).

Replies: 1 comment 4 replies

Comment options

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

@ekwoka
Comment options

@SimoTod
Comment options

SimoTod Jan 23, 2025
Collaborator

@robkuz
Comment options

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