Replies: 1 comment
-
Thanks. I consider that approach and it would be my go to if I did not have the ability to go deep into the Blazor framework. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I saw an interesting approach to using fragments with htmx that I thought was worth bringing to your attention. This is more of a style choice but this would allow you to have a single component page that also embeds all the sub-components that might need to be directly addressed. Basically you just parameterize your fragments and embed them as static methods in your components. Then you can both call them from within the razor component as well as from outside of the component via mapping routes directly. Outside of the fragment you just need to provide the correct parameters but you can then just wrap the Renderfragment in another component and output it directly as an IResult with a minimal API route.
See this (note that you could still create markup for ArticleFragments.razor itself as a component that uses the static methods):
https://github.com/Erikvdv/realworld_htmx_blazorfragments/blob/main/src/App/Components/Pages/ArticleFragments.razor
FragmentComponent.razor
RenderHelper.cs
Beta Was this translation helpful? Give feedback.
All reactions