Producing slot machine effect with react | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Producing slot machine effect with react

Hey everyone, could someone maybe give me a couple of tips how do I create slot machine effect with react with no libraries? I've tried using useEffect and setTimeot and setInterval, but Its not what Ive expected. How do we create something like this as smooth as possible and displaying 3 units vertically per row? Whats the logic behind recreating slot machine effect? Ty in advance

5th Dec 2020, 11:11 PM
Tadas
Tadas - avatar
1 Answer
0
You want display 3 units vertically for row when for example run a function? If Is that. You can create a component for the single units like a container and import it on father component for three times. In the father component you can implement the Logic. For example you have an Array With N elements. And onClick you run a random function that return an Array element. For do that you must to pass props father to child component
6th Dec 2020, 1:20 PM
Alessio Farroni
Alessio Farroni - avatar