carlquistb / FormulaCraft

An SMS-based service for running Minecraft server on AWS.
MIT License
0 stars 1 forks source link

onClick for createStackWithWorld #17

Closed carlquistb closed 4 years ago

carlquistb commented 4 years ago

it seems like no matter which card is selected, the onlick is referencing the same world / flavor info from localStorage.

Currently, no matter which card is selected, the method is passed the same data. Always Hogwarts and flavor1.

carlquistb commented 4 years ago

the onClick listener cannot reference state from the iteration from which it is assigned. So, the world[i] wasn't giving what we wanted. To get around this, I utilized static attributes on the element. Used data- attributes. Decided not to utilize this.dataset. because the syntax would require lowercase naming. I'd rather keep the naming consistent for these API params.

extending work: we should consider passing a params object instead of variables. 4 is a middle ground number, it isn't required.