🕺🏽 Step through an index with style: Primitives for building step/index based UI widgets controlled by swipe, timers, and/or buttons in React.
Thanks @connor-baer for submitting #12.
This release also includes an improved README thanks to emdaer. Check it out if you haven't tried it.
Somewhere in the course of refactoring things, componentWillUnmount
got removed 🙃 . That is fixed now.
Thx @lkbr for submitting infiniteluke/dub-step/issues/9.
3 of the hardest CS probelms:
I've decided to make a ⚠️ breaking change⚠️ and rename index
to step
. This fits with the name of the package better and is more descriptive of it's role. This is a minor change but will break your current code if you rely on index
, which you probably do.. See the docs for details.
@kentcdodds' tweet and the attached poll got me thinking that dub-step should provide components powered by the existing prop getters as folks will probably find them easier to use. Prop getters are more powerful and will continue to be supported, but the provided components Next
, Previous
, Play
, Pause
, and StepIndex
will be the recommended approach for using dub-step from now on.
To be clear, both of these options work and the main difference is preference:
...
<button {...getNextControlProps()}>Next</button>
...
and
...
<Next>Next</Next>
...
Next
and getNextControlProps
and the like are both provided in dub-steps child function.
See the README and the docs for more info!
Also check out detailed examples on Codesandbox!
🕺🏽 Step through an index with style: Primitives for building index based UI widgets controlled by swipe, timers, and/or buttons.
Use this.next() and this.previous() in swipeEnd so that onNext & onPrevious prop callbacks get called.