-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing value(s) of an object with this
throws error.
#4153
Comments
It works if you do |
|
|
No. this is expected. you need to bind your callback function if you want to get the
This is not about Svelte actually, you can look at this CodeSandbox, telling you the difference between a bound and unbound callback function. a working repl do note that, assigning |
I see the difference very clearly, thanks a lot but using |
no. |
So, you are saying that the error property isn't reactive, right? |
@roket1428 https://svelte.dev/repl/2b6e48f9cce14134b36aee50d2fb80b6?version=3.16.5 From my understanding, Svelte uses variables to understand when something is reactive. Here's an example that doesn't use the https://svelte.dev/repl/226b2b1d68f54c9dbc50ca4301b2ac7b?version=3.16.7 You might want to avoid nested functions inside of objects that use the |
I was trying to access all values of all fields that I can have in a certain page. For example
username
field's value,password
field's value,firstname
field's value andlastname
field's value and so on. With the approach in my mind, I could access the values of all fields in a certain page and I can manipulate every individual error messages based on those values like I won't allow users to have same values inusername
field andpassword
field. But, as you can see at the demo, it doesn't work as I expected. So I'm looking for possible solutions or better approach than mine. :)Demo: https://svelte.dev/repl/ac89d68f4047497f96bc0fac88fd2fd1?version=3.16.5
The text was updated successfully, but these errors were encountered: