Summary
In this chapter, we introduced how to create Razor components. We learned about data binding and the component lifecycle. After that, we created a set of modal dialog components to clean up our code. With Razor components, we can remove duplicated code and improve the UI design. We implemented CRUD operations in the event handlers of modal dialogs. We now have a new version of the password manager app.
During the code analysis, we can see that we still have redundant code in the two main components, Items
and ItemDetail
. Even though we optimized modal dialogs, we still have duplicated code in the list group and context menu. We will convert them to Razor components in the next chapter.