Re:How to avoid rewriting your JavaScript application
by henriquelimao on Thursday October 20, 2016 @05:55PM
(#12756526)
It is not common, easy, efficient or idiomatic, but you can:
Imagine that in each event handler, instead of doing something, you just update some state somewhere, and after that call a common "draw" function.
Inside the "draw" function you redraw all your UI: apply effects, etc.
That's it, you have it.
[ Parent
| on HN ]
Re:How to avoid rewriting your JavaScript application
by jowiar on Thursday October 20, 2016 @06:01PM
(#12756558)
Along these lines, this is why Dan Abramov's Getting Started with Redux[1] is one of my favorite tutorials to anything, ever. The concepts are simple, and half the tutorial is walking through creating a naive implementation of Redux. The actual library, of course, involves performance optimizations and better edge case handling, but at the very least, having a "this is sort of what the innards look like" is a really nice start to approaching anything.