Posts

Showing posts from August, 2019

Basic Blazor Components

First it is important to know that everything in Blazor is a component.  Razor components and Blazor components are the same and the terms are interchangeable.  Even a full razor page is a  component .   There are 3 types of components in Blazor:   Inline – The markup and the code are within the same page   @page   "/counter"        < section >            < h2 > Counter </ h2 >            < p > Current count:  @ currentCount </ p >            < button   class ="btn btn-primary"   @ onclick =" IncrementCount "> Click me </ button >        </ section >   @code   {        int  currentCount = 0;        void  IncrementCount()       {           currentCount++;       }   }   Code Behind Component – The mark up and the code are in different files.  There are 2 main parts to remember:   In the code behin