Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(next?: number) => {
index.current =
typeof next !== "number"
? wrap(0, items.length, index.current + 1)
: next
setItem(items[index.current])
},
]
export const App = () => {
const [[page, delta], setPage] = useState([0, 0])
const imageIndex = wrap(0, images.length, page)
const paginate = (newDelta: number) => {
setPage([page + newDelta, newDelta])
}
return (
<div>
<img src="{images[imageIndex]}">
paginate(1)}></div>