locked
blazer server | what does base.OnAfterRender(firstRender); do? RRS feed

  • Question

  • User2110873642 posted

    why is this in my onafterrender method?

    do i remove it? or put my code below or above it?

       public override void OnAfterRender(bool firstRender)
        {
             base.OnAfterRender(firstRender);
        }

    Tuesday, August 4, 2020 12:07 AM

All replies

  • User-474980206 posted

    you should read the blazor docs and learn c#. the method is explained in the docs, and knowing C# would let you know you could safely remove the method and just use the inheritied method (even without know its use).

       https://docs.microsoft.com/en-us/aspnet/core/blazor/components/lifecycle?view=aspnetcore-3.1

    if you want to add code to this method, it depends. the base blazor class does not require a call, but if your component is inheriting from a custom component then you need to know the side effects of that component. do you want your changes before or after, or is there no difference.

    this is one of main complaints about class inheritance, you really need to know every layers side effects, or you can introduce problems. 

    Tuesday, August 4, 2020 12:22 AM