-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Swiper Element] Server Side Component Support #6913
Comments
up |
Any updates on this? We are updating to react 18, and this is causing us to have to force any elements that have a react swiper to be rendered client side. If we can, we would love to be able to render them on the server. There is no data in them that requires loading on the client. |
same here, let's go HEROS! |
https://www.youtube.com/watch?v=imhdh4xCh7I followed it and it worked just fine 🚀 "use client";
import Image from "next/image";
import { Swiper, SwiperSlide } from "swiper/react";
import { Navigation, Pagination } from "swiper/modules";
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/pagination";
import { images } from "@/lib/images";
export default function Page() {
return (
<section className="py-12">
<div className="container">
<Swiper
navigation
pagination={{ type: "bullets", clickable: true }}
modules={[Navigation, Pagination]}
onSwiper={(swiper) => console.log(swiper)}
className="h-[500px] w-full rounded-lg"
>
{images.map((image) => (
<SwiperSlide key={image.alt}>
<div className="flex h-full w-full items-center justify-center">
<Image
src={image.src}
alt={image.alt}
className="block h-full w-full object-cover"
/>
</div>
</SwiperSlide>
))}
</Swiper>
</div>
</section>
);
} // @/lib/images.ts
import first from "@/public/slides/first.jpg";
import second from "@/public/slides/second.jpg";
import third from "@/public/slides/third.jpg";
import fourth from "@/public/slides/fourth.jpg";
export const images = [
{ src: first, alt: "first" },
{ src: second, alt: "second" },
{ src: third, alt: "third" },
{ src: fourth, alt: "fourth" },
]; |
Up |
@felipe-muner swiper-react will be deprecated. This is about swiper-element |
Up 👍 |
any update on this? |
For anyone trying to use swiper in react, suggest to migrate to embla that's used under the hood in shadcn |
up |
2 similar comments
up |
up |
Clear and concise description of the problem
In a
npx create-next-app@latest
boilerplate add this componentYou will receive this error:
Suggested solution
Alternative
No response
Additional context
https://lamplightdev.com/blog/2019/07/20/how-to-server-side-render-web-components/
https://nextjs.org/docs/getting-started/react-essentials#third-party-packages
Validations
Would you like to open a PR for this feature?
The text was updated successfully, but these errors were encountered: