Skip to content
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

react router reload page after loop image #505

Open
ubay1 opened this issue Oct 7, 2021 · 0 comments
Open

react router reload page after loop image #505

ubay1 opened this issue Oct 7, 2021 · 0 comments

Comments

@ubay1
Copy link

ubay1 commented Oct 7, 2021

Screenshot_4

Screenshot_1

i enabled loop: true..

but the on the react router when the first image is in the loop then I click the image to move the page but the page reloads, the SPA doesn't work. but if i click the first image without image loop, SPA works

const params = {
    slidesPerView: 4,
    spaceBetween: 30,
    pagination: {
      el: '.swiper-pagination2',
      clickable: true,
      show: false
    },
    breakpoints: {
      800: {
        slidesPerView: 4,
        spaceBetween: 40
      },
      200: {
        slidesPerView: 3,
        spaceBetween: 40
      }
    },
    loop: false,
  }

  return(
    <div className="mx-0">
      <div className="text-md font-bold">Kategori Pilihan</div>
      <div className="mx-0 mt-4">
        <Swiper {...params}>
        {
          kategoriPilihan.map((item: {image: string, title: string, param:string}, idx: number) => {
            return(
              <Link to={`/detail-kategori?q=${item.param}`} key={`key kategoriPilihan - ${idx}`} className=" mr-2 py-4 flex  justify-center border border-gray-200 rounded-md cursor-pointer">
                <img src={item.image} alt={item.title} className="w-32"/>
              </Link>
            )
          })
        }
        </Swiper>
      </div>
    </div>
  )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant