When you place the "@" before the "onclick", you create a compiler directive. This constructs is going to be enforced in the future, if it is not yet enforced. It instructs the compiler to create an EventCallback object, which provide the appropriate delegate for necessary to handle the code you assign as the value of the @onclick directive. This setting: @onclick="() => methodCall()"
tells the compiler to produce an EventCallback object that provide the appropriate delegate to execute a lambada expression. Note that you use this construct when you want to pass a value to the method encapsulated by the lambada expression, as for instance:
@onclick="() => methodCall('Hello world')"
void methodCall(string str)
{
}
If you don't have to pass a value to a called method you should construct the @onclick directive as such: @onclick="methodCall"
or @onclick="@methodCall"
The "@" sign tells the compiler that the value of the @onclick directive is executable code, and not merely a string, in which case an error would have been triggered. But as you can see, the "@" sign can be omitted, and no error is raised because the compiler knows it is a method name for which it creates an EventCallback struct object with the appropriate delegate.
This onclick="@methodCall()"
is wrong. It tells Blazor to create an input Html element whose value should be a JavaScript method named 'methodCall', and it should be defined and executed in Blazor (C#). No such an animal.
You may use construct like this: `onclick="methodCall()", in which case you'll need a JavaSript method named methodCall defined...
You can also do this: onclick="alert('I'm a JavaScript method')"
What is most important to remember that when you use the Html element attribute onclick, its value should be a JavaScript method. This is entriely different than the @onclick compiler directive...
Hope this helps...