fix: mark Carousel as a client component for Next.js 15 compatibility#1100
fix: mark Carousel as a client component for Next.js 15 compatibility#1100anshukushwaha07 wants to merge 1 commit intoFormidableLabs:mainfrom
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Marks the Carousel component as a Next.js Client Component to prevent runtime errors when it’s imported/used from Server Components (Next.js 13+/15), since it relies on client-only React APIs.
Changes:
- Added the
"use client"directive toCarousel.tsxso Next.js treats the component as a Client Component.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,3 +1,5 @@ | |||
| "use client"; | |||
There was a problem hiding this comment.
This file is formatted with double quotes for the "use client" directive, but the repo’s Prettier config enforces single quotes (singleQuote: true) and ESLint runs prettier/prettier as an error. This will likely fail linting; update the directive to use single quotes to match formatting rules.
| "use client"; | |
| 'use client'; |
This PR fixes an error when using the Carousel component in Next.js 13+/15 Server Components:
The error occurs because Carousel uses client-only React APIs (useEffect, useState, createContext) but was not marked as a Client Component.
Fix: Added the "use client"; directive at the top of Carousel.tsx, ensuring Next.js correctly treats it as a Client Component.
Fixes #1094
Type of Change
How Has This Been Tested?
Checklist