'react I want to change the order
When the button is pressed, I want it to swipe in the following order: yellow, red, blue, green.
Solution 1:[1]
Check this out. Now, it is working fine, I guess.
You were subtracting back.length
(not valid) whereas you hav to do background.length
for z-index
I have added position: relative
and z-index
to the other Box
in else
as well. Earlier, the card at the last was having highest preference die to no z-index
but now it is fine.
https://codesandbox.io/s/magical-swartz-1u70q?file=/src/App.js
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |