I am using Swiper slider in React to slide cars and it is working fine. But I have a language switcher in my App from English to Arabic and for language switch I am using i18n https://react.i18next.com/
The problem is when I switch language Swiper slider breaks. Let me show you preview and code
This is normal in English language
and this is the issue when I switch to arabic
code is here
<Swiper
loop={true}
parallax={true}
navigation={{
prevEl: prevRef.current!,
nextEl: nextRef.current!,
}}
speed={400}
grabCursor={true}
effect={"fade"}
mousewheel={true}
fadeEffect={{ crossFade: true }}
thumbs={{ swiper: thumbsSwiper }}
modules={[EffectFade, FreeMode, Navigation, Thumbs]}
className="car_swiper"
dir={!langDirection ? "rtl" : "ltr"}
>
langDirection is a state use to check the language switch when it's false it means arabic. When it's true it means English