onClick not triggering
Unanswered
Valentine ant posted this in #help-forum
Valentine antOP
My button's
Here is the file:
Nothing in browser console or local terminal. Any ideas?
Running this on WSL2 (also tried on just Windows, and it still didn't work).
onClick() events weren't working, so I made a new project and I am still running into the same issue.Here is the file:
"use client";
export default function Home() {
return (
<main>
<div>
<button onClick={() => console.log("naur")}>Click Me</button>
</div>
</main>
);
}Nothing in browser console or local terminal. Any ideas?
Running this on WSL2 (also tried on just Windows, and it still didn't work).
10 Replies
European sprat
Make sure your node version is updated
Like 18.17.1
Valentine antOP
My node version is 18.17.1 currently:
https://i.imgur.com/U7x6Su7.png
https://i.imgur.com/U7x6Su7.png
European sprat
show the rest of the code then
Valentine antOP
import './globals.css'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
)
}this is just the default app generated by create-next-app
the only thing changed was
page.tsxValentine antOP
bump
European sprat
Create a minimal reproduction that others can test