7 Creating more reusable components

This chapter covers

  • Using templates to define specific regions of UI
  • Enhancing templates with generics
  • Sharing components using Razor class libraries

Reusability is one of the compelling reasons for using components. They allow us to define chunks of markup and logic that can be reused by simply referencing them in other markup. This is an immensely powerful tool. So far, we’ve taken advantage of this on several occasions in previous chapters:

  • TrailCard component

  • FormSection component

  • FormFieldSet component

  • SuccessAlert and ErrorAlert components

NOTE If you’re following along building the example application, you will need to complete appendix B before starting this chapter.

In this chapter, we’re ...

Get Blazor in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.