fresh-server-event-handlers
NOTE: this rule is part of the
fresh
rule set.Enable full set in
deno.json
:{ "lint": { "tags": ["fresh"] } }
Enable full set using the Deno CLI:
deno lint --tags=fresh
Disallows event handlers in fresh server components.
Components inside the routes/
folder in a fresh app are exclusively rendered
on the server. They are not rendered in the client and setting an event handler
will have no effect.
Note that this rule only applies to server components inside the routes/
folder, not to fresh islands or any other components.
Invalid:
<button onClick={() => {}} />
<button onclick={() => {}} />
<my-custom-element foo={() => {}} />
Valid:
<button />
<my-custom-element />