You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given I have a NextJS 14 app with app router
When I use <Button> component without onClick event listener attached in Server Component
Then error occures which says that I can use Events handler only in Client Component props.
What should be happening?
I should be able to use component without listeners attached in Server Components
Steps to reproduce issue
Create new app using NextJS 14 - next@14.1.4
Configure it to use app directory (usually defaults)
Install reactstrap
Change /app/page.tsx with this snippet:
import { Button } from 'reactstrap';
export default function Home() {
return (
<div>
<Button>Test</Button>
</div>
);
}
Error occures
Error message in console
⨯ Error: Event handlers cannot be passed to Client Component props.
<button type=... children="Test" className=... onClick={function} aria-label=...>
^^^^^^^^^^
If you need interactivity, consider converting part of this to a Client Component.
at <anonymous> (https://stackblitzstarterssr13hs-s4xa.w-credentialless-staticblitz.com/blitz.7dbe22a9.js:352:114817)
at <anonymous> (https://stackblitzstarterssr13hs-s4xa.w-credentialless-staticblitz.com/blitz.7dbe22a9.js:352:115116)
Button
#9.2.2
esm
#18.2.0
#5.3.3
What is happening?
Given I have a NextJS 14 app with app router
When I use
<Button>
component withoutonClick
event listener attached in Server ComponentThen error occures which says that I can use Events handler only in Client Component props.
What should be happening?
I should be able to use component without listeners attached in Server Components
Steps to reproduce issue
next@14.1.4
app
directory (usually defaults)reactstrap
/app/page.tsx
with this snippet:Error message in console
Code
https://stackblitz.com/edit/stackblitz-starters-uy9b2t?file=app%2Fpage.tsx
The text was updated successfully, but these errors were encountered: