Next.js Discord

Discord Forum

question?: So I am building a slot machine. My reels are arrays of objects/images.

Unanswered
brad posted this in #help-forum
Open in Discord
export const reel1 = [
{
id: 1,
name: "c0",
value: 0,
imgUrl: "/c0.svg"
},
{
id: 2,
name: "c2",
value: 0,
imgUrl: "/c2.svg"
}
]

there is alot more indecies and 3 reels, but you get the point.
so i import the reels shuffle the array then map thru them and render them to my machine using framer motion for a dropping effect.

my problem I cant figure out is when i log each reel it counts them twice.. like reel1 has two logs for every console log and same with reel 2 and reel 3. I am trying to count wins and It doesnt work because it doubles the win sometimes. does anybody know why it counts the arrays twice? oh and it resets everytime before it spins... I dont know if that matters tho.

0 Replies