onClick does not work #716
-
/routes/index.tsx export default function Home() {
return (
<button
onClick={() => console.log("test")}
>
test
</button>
);
}; No log is output when I click on the "button". |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Click handlers and similar only work inside of island components, because only islands are shipped to the client. Please read https://fresh.deno.dev/docs/getting-started/adding-interactivity |
Beta Was this translation helpful? Give feedback.
-
It seems I didn't read the I encountered the same issue today when using the onClick event on an It turns out that This answer helped me, thank you! |
Beta Was this translation helpful? Give feedback.
Click handlers and similar only work inside of island components, because only islands are shipped to the client. Please read https://fresh.deno.dev/docs/getting-started/adding-interactivity