3 ms·
Consider pressing a "play" button to first start playing the video but then also remove itself from the UI and replace it with a "pause" button that when clicke
by usmannk 6y ago
Consider pressing a "play" button to first start playing the video but then also remove itself from the UI and replace it with a "pause" button that when clicked does the inverse. The UI here is acting as a state store but the functions can then be designed as purely functional, acting only on their inputs.
- andrekandre 6y agoah, that makes more sense i think... yes, i guess that is one way of accomplishing it, thanks ^^
- usmannk 6y agoI don’t recommend this strategy in practice though. It’s brittle and not all application state can even be represented as UI (what about your login cookie?).