79232792

Date: 2024-11-28 06:35:59
Score: 3
Natty:
Report link

My view is.

If you have common html with no special logic, api or dB requirements and what you need is common to pages and can use the page viewmodel data. Then go with a partial view. Bootstrap modals and wizard navigation buttons are good examples that I use them for.

I use viewcomponents when I want to encapsulate some html, logic, dB and/or api calls that have little dependency on the page itself. But needs to do a fair bit of work to get data and render itself. Essentially independent of the page viewmodel and self contained. Menus and information headers are examples for me. Just drop a one liner in your page and boom! Write once, use everywhere.

Anyone remember ActionPartials? Lol

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • No code block (0.5):
  • Ends in question mark (2):
Posted by: djack109