-
-
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
Using breakpoints option in Next JS causes Hydration error #5784
Comments
Than same issue with me also |
Same here |
I am also facing the same issue. |
Same issue |
Using Sample Code for reference <Swiper
spaceBetween={10}
slidesPerView="auto"
breakpoints={{
320: {
slidesPerView: 1,
spaceBetween: 30,
},
640: {
slidesPerView: 1,
spaceBetween: 10,
},
768: {
slidesPerView: 2,
spaceBetween: 20,
},
1024: {
slidesPerView: 3,
spaceBetween: 30,
},
}}
>
<SwiperSlide>Slide one</SwiperSlide>
</Swiper> |
This actually makes sense. Your static build created the HTML without a screensize, so the default settings are run. When your JS runs for the first time, it will consider breakpoints, thus creating a mismatch in HTML elements. |
Thank you for the solution. It works. |
I want to have a bit of the next slide peaking on the screen, so slidesPerView=auto won't work for me- any other ideas or possible fixes you came up with? |
At the moment, No |
This is my solution. I have used Tailwind CSS, and wrapped |
Great Solution. |
Just want to clarify here, |
|
If you decide to use |
Thank you for the solution. It works. |
Is anyone still getting hydration error even after using slidesperview ="auto" ?
|
Yes |
I had a similar situation, but solved it by limiting Swiper calls to client-side. It may be a bit of a messy solution....
|
it does not worked for me . |
I don't know is it dirty or not? but i fixed it by the code :
|
Even if we keep swiper client side, isn't it causing a huge CLS ? |
That works, Thanks!! |
Thanks it worked for me. :) |
Thank you for this, I feel this is the best solution on this thread! I made some small simplifications: ` useEffect(() => { const testimonialCarousel = {
|
this is nice |
Discussed in #5776
Originally posted by Sakkhor909 June 7, 2022
First of all, thank you for this amazing library.
Everything works fine until I use breakpoints
The error is shown on the next js page
The text was updated successfully, but these errors were encountered: