I'm trying to wrap my head around avoiding state using JavaScript functional programming techniques. I have a solid grasp of many basic fp techniques such as closures, currying, and so on. But I can't wrap my head around dealing with state.
I'd like to know how someone creating a functional program would implement the following very simple application:
A user clicks a button in the browser (jQuery implementation is fine). The value onscreen should increment by 1 each time the user clicks the button.
How can we do this without mutating state? If mutating state is necessary, what would be the best approach from a functional perspective?