Razor is the dotnet templating language, Razor is the syntax used to create views in dotnet applications. It will normally be found in `.cshtml` files. You can think of it in a similar way to JSX, in that Razor is to C#, what JSX is to Javascript in a React application.
Templating languages don’t transform data, but arrange it for display in a view.
Example displaying a list in JSX:
const list = (items) => {<br> return (<br> <ul><br> {items.map((item, index) => (<br> <li key={item}>{item}</li><br> ))}<br> </ul><br> );<br>}Displaying the same list in Razor
<ul><br>@foreach(var item in items) {<br> <li>@item</li><br>}<br></ul>Further Reading
A great cheatsheet for copy + paste
https://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx/
A good abstract overview of templating engines as a whole:
https://thomaslevine.com/computing/templating-languages/
The Microsoft ASP.net Razor Guide

Comments
No comments yet