-
Notifications
You must be signed in to change notification settings - Fork 9.9k
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Blazor two-way binding across more than two components (clarification on this documentation) #57962
Comments
Apologies, @adamgf1. I was just looking at our doc disscussions when I posted that. I'll keep an 👁️ on this ... one of the Blazor engineers will respond to you shortly here. If we need a docs issue to modify that section, I'll open it after the discussion concludes here. |
Hi @guardrex, not sure what post you're referring to but whatever the case no apology is necessary 😃 Now that you mention doc discussions, I realise this really should have gone into AspNetCore.Docs, shouldn't it. Sorry about that. |
I was referring to a comment that I deleted and then replaced ☝️ there. No problem opening this here, as I'd need to ask them to look at your issue anyway. The content that you're referring to was approved multiple times over the years when it was first provided several years ago and updated a few times since then, but we might end up with new content based on the discussion here. I'm 👂 to see where your question goes. |
Hi,
I see the contributing guidelines encourage general feedback and discussions here, so hopefully this is the place for this question.
This is regarding the Bind across more than two components example in the documentation.
I've been reading these pages a lot in the past few days, trying to get my head around the details, and there's one thing I'm not clear on:
In the example linked above, where the
NestedChild.razor
component is essentially acting as a pass-through between theParent2.razor
andNestedGrandchild.razor
components, is there a meaningful difference between what the example shows by using@bind:get
/@bind:set
modifiers:And something like this, where I'm passing down the parameter and event callback as "normal":
?
My understanding so far is leading me to believe that the exact way that the example is written, to use the
@bind:get
and@bind:set
modifiers, is not actually necessary in this case, and it's not necessary because of the way theNestedChild.razor
component happens to have its parameter/callback matching the type (string
) of theNestedGrandchild.razor
component's parameter/callback, and isn't:NestedGrandchild.razor
component anything different to its ownChildMessage
parameter value on the way downNestedGrandchild.razor
'sGrandchildMessageChanged
event callback on the way upIn other words, I think I can see why the
bind
syntax should be used for example if theNestedChild.razor
component wanted to transform the string given by theNestedGrandchild.GrandchildMessageChanged
event callback, before in turn passing it up to theParent2.razor
component via theNestedChild.ChildMessageChanged
event callback.But in the way that the example is actually written, where no such transformations are going on, I guess my main question is whether there's a reason why the
@bind
syntax should be used in this kind of scenario, as opposed to using the other example snippet I gave where the straight passing-through of the parameter and callback is done from child to grandchild component?(The reason I ask is that I have this exact situation in the code I'm working on, and the current implementation is using the passing through of parameters and callbacks approach, without
@bind
, and so I'm trying to figure out if I'm missing something important by not having this code follow the way the documentation example is written.)Hopefully that's a clear enough explanation, thanks in advance for any clarification on this.
The text was updated successfully, but these errors were encountered: