Comments (3)
Hi, I just created a new Next.js project for testing purposes and successfully deployed it on Vercel.
In the customized Carousel Component, I used 'use client'.
'use client'
import BearCarousel, {BearSlideCard} from 'bear-react-carousel';
import "bear-react-carousel/dist/index.css";
export default function Carousel() {
// ..... other ignore
return <BearCarousel data={bearSlideItemData} height="400px" />;
}
Then, I dynamically imported it in the place where it is being used.
import dynamic from 'next/dynamic';
const Carousel = dynamic(() => import('../components/Carousel'), {
ssr: false,
});
export default function Home() {
return <div>
<Carousel/>
</div>;
}
You can try this example to see if it solves your problem. If you still encounter issues, please provide a git repository that can reproduce the problem.
https://nextjs-bear-carousel-example.vercel.app/
I hope this can help you.
from bear-react-carousel.
import dynamic from "next/dynamic";
const BearCarousel = dynamic(
() => import("bear-react-carousel").then((mod) => mod), {ssr: false}
);
The problem is that if the files are inside a component, it gives an error on Vercel.
'use client'
import dynamic from "next/dynamic";
import { BearSlideCard } from "bear-react-carousel";
import "bear-react-carousel/dist/index.css";
const BearCarousel = dynamic(
() => import("bear-react-carousel").then((mod) => mod), {ssr: false}
);
const Carousel = () => {
const images = [
{ id: 1, imageUrl: "https://dummyimage.com/900x400/dee2e6/6c757d.jpg" },
{ id: 2, imageUrl: "https://dummyimage.com/900x400/dee2e6/6c757d.jpg" },
{ id: 3, imageUrl: "https://dummyimage.com/900x400/dee2e6/6c757d.jpg" }
];
const bearSlideItemData = images.map((row) => {
return {
key: row.id,
children: <BearSlideCard bgUrl={row.imageUrl} />
};
});
return <BearCarousel data={bearSlideItemData} height="400px" />;
}
export default Carousel;
from bear-react-carousel.
@thefubon I found the issue you mentioned. After performing the build and deploying it to Vercel, no errors occurred. You can try version 4.0.9
again.
example: https://github.com/imagine10255/nextjs-bear-carousel-example/blob/main/src/components/Carousel2.tsx
from bear-react-carousel.
Related Issues (15)
- Test
- Props: isEnableMouseMove HOT 6
- Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. HOT 1
- data diff not update HOT 2
- Documentation site down HOT 7
- RWD Preview not work HOT 1
- feature: Increase Test coverage than 70%
- feature: Reduce the package size by 30%.
- feature: Loop mode use sort by one slide pre view
- Add delay for "autoPlayTime" HOT 3
- add juejin member level sync effect example HOT 1
- BearSlideCard child use padding HOT 2
- bug: scroll on touch screen devices does not work HOT 3
- bug: activePage is greater than total when using more than 1 slidesPerView with isEnableLoop={true} and going to the borders HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bear-react-carousel.