Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How is your experience with more "advanced" stateful interactions such as drag&drop?


Good. I have written drag and drop functionality in Elm a few times. I have a clear enough idea on how that code looks that if I had to write a drag and drop today, I think I could crank it out quickly.

You call it stateful tho. I dont know that drag and drop needs to be all that stateful. For drag and drop, the information your model needs is whether you have mouse-down-ed on something, the coordinates on the html element you mouse-down-ed, and the coordinates the mouse's current location is. 2 pairs of coordinates and a maybe type? Not too bad. I guess there is the code too, but at least the data is just few values, and not a complex and nested data structure.

On my team at work, we avoid state. Complex nested state is a big code smell for us.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: