Lundeful
What is the equivalent of this react component if made using C# and Blazor?
Cool stuff! Looks like you've been going down that rabbithole a lot more than me 😄
Does sort of feel like we're working against the framework when doing this, but if it works it works.
13 replies
What is the equivalent of this react component if made using C# and Blazor?
Extracted it to a utility class and put the project into a public repo so it doesn't get lost
https://github.com/Lundeful/reusable-blazor-components
Hopefully we'll get a better solution for this soon
13 replies
What is the equivalent of this react component if made using C# and Blazor?
@mg
Got it working in a simple example here. Also using tailwind, which is where I think this can be a huge win.
I'm basically just checking to see if the class is there, kinda wonky since it can be null
Kinda wonky since the attributes is a nullable readonly dictionary and there isn't exactly an upsert for dictionary. That part can just be taken out as a utility function/extension method or something and then it can look quite clean in usage
Definition
Usage
And it works fine by overriding the base value as I do here.
Only problem is this does not work well with MudBlazor since all of their utility clases have
!important
on them 💀 The specificity got weird it seems like.
With Tailwind you can use the @apply
directive to reuse styles, but this method can do more than just template the styles13 replies
What is the equivalent of this react component if made using C# and Blazor?
I see that the components, such as
InputText
, are just classes that I can inherit and perhaps edit and override what I need from there. Seems like I can do this just using code and not bother with the html syntax at all. Seems a lot easier and more maintainable. I'll have to experiment, but seems like it will be easier than I feared 😄
Back to reading the source code13 replies