Here's a function that will iterate an array left or right and return the index each time:
index.tsx525 chars23 lines
To use it, first create the function with the array and direction as arguments:
index.tsx97 chars4 lines
Then, call the iterator function to get the next index each time:
index.tsx208 chars7 lines
gistlibby LogSnag