npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

simpleswiper

v0.10.6

Published

Super duper swiper

Downloads

82

Readme

SimpleSlider

SimpleSlider allows you to simply implement Sliders with mobile app grade gesture handling. It doesn't limit itself to images. You can place in slides any HTML content you want.

Why React doesn't have its own presets?

As you could have noticed, we use SimpleSlider instances inside React components and take full imperative approach.

The reason for this is that slider UI state is complicated (position, animation, speed, etc) and requires heavy orchestration of state variables (not every combination of state variables is correct). If we make slider dummy, this state management logic would have to go to parent. This doesn't make sense because its slider who knows how to manage state logic. This means that calling SimpleSlider methods is simply th best solution to drive internal state changes.

Why no ReactSimpleSlider helper?

We tried it and it failed.

First, we need to have ref to this ReactSimpleSlider component always. To have access to all methods (moveTo, visibleSlides, etc).

We also got to conclusion that layout method must be always called in component that instantiates ReactSimpleSlider, which complicates API and doesn't allow us for simply putting ReactSimpleSlider to render() and keeping parent component stateless. The reason for that is that if layout is called inside ReactSimpleSlider, SimpleSlider automatically calls all the events (onActiveSlidesChange, onMove etc). Those events are usually used by parent component. And when they're called, parent component still doesn't have ReactSimpleSlider ref initialized, because it's child who is being initialized at the moment. This led to conclusion that it's parent who should control everything and we shouldn't put partial control to ReactSimpleSlider.

Also, all that ReactSimpleSlider did was rewrite API of SimpleSlider to props. That casued many bugs, where SimpleSlider did have some method and ReactSimpleSlider didn't. It doesn't make sense to copy APIs and DX doesn't seem to be much better with props.

Another thing is that having slideMargin, slideSnapOffset etc functions in render is tempting to use () => 200 syntax inside render method and instantiate new local methods every time render is called which is super inefficient if we have many of that methods.

Also, all the components (pager, arrows, touchspace) require Slider instance and the code of parent of ReactSimpleSlider was full of this.sliderRef.current.slider.sth, while without we have only this.slider.sth.

At the end of the day SimpleSlider is very imperative component and it should stay this way within React (or Vue) realm.