Closed ericqt closed 3 years ago
Hey @ericqt. You are defining components within components in the non-working example. Whenever your sliderValue
state changes the components are going to be redefined, and I'm not sure what happens then.
I would recommend using your working example regardless of this issue you are experiencing!
If I setup all the slider components in the same file (in app.js) the slider doesn't slide around but if I break out the slider to a separate file and import it in, it will start working.
Does anyone know why this happens? Is there some sort of JS nuance that I'm not aware of?
Code where slider works when broken out to another component: https://gist.github.com/ericqt/f2cbebc8d2ac032364cf32aa86fd7b7e
Code where slider doesn't work within the same file as app.js: https://gist.github.com/ericqt/239d1f111c9f9ddfa876c686b9ea182c