How to do functions in separate razor file in .net core?

Viewed 55

In .net I could palce razor helpers in a separate fie under App_Code and then use them in my razor views.

How to do it in .net core?

I know that there are no helpers, just razor functions but how to place them in a separate file and reuse in views?

Should I use a razor component or external razor library for this? Like described here: https://docs.microsoft.com/en-us/aspnet/core/blazor/components/class-libraries?view=aspnetcore-5.0&tabs=visual-studio ?

I just don't see a point of creating a whole separate project or class library for a few simple functions. But need to reuse them in various views.

0 Answers
Related