You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is no way to overload [Parameter]'s in Razor Components. For example if you have an OnClick parameter, it has to be an Action<UIMouseEvent> or Func<Task>. This creates 2 parameters on a <MyButton/> component, if you want a async delegate and a sync delegate. Else you'll have to write stuff like
OnClick=@(async(e)=>await DoSomething())
The issue
If you look at the Child Component MyButton we have 2 parameters to handle an action OnClick or OnClickAsync. Isn't it possible to combine these 2 parameters into 1?
Currently there is no way to overload
[Parameter]
's in Razor Components. For example if you have anOnClick
parameter, it has to be anAction<UIMouseEvent>
orFunc<Task>
. This creates 2 parameters on a<MyButton/>
component, if you want a async delegate and a sync delegate. Else you'll have to write stuff likeThe issue
If you look at the Child Component
MyButton
we have 2 parameters to handle an actionOnClick
orOnClickAsync
. Isn't it possible to combine these 2 parameters into 1?Parent Component
Child Component (The button itself)
Basically it would clean up the calling code to
coming from:
DoSomething()
being aAction<UIMouseEvent>
orFunc<Task>
.The text was updated successfully, but these errors were encountered: