Hacker News new | ask | show | jobs
by henriquelimao 3530 days ago
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.
1 comments

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.

[1] https://egghead.io/courses/getting-started-with-redux