A thought that occurred to me this morning is recursion can be an alternative to state.

Example: say you want to find matching pairs in a large list. You could look through every item and...

A) Set matches aside in a tmp list

B) Pass in the remaining items into the same function, work back up the stack combining all the items together

I believe this is how and redux work: a giant nest of functions that pass in the single piece of state that then works its way back up the stack, returning new state. (Not 100% sure on this)

Sign in to participate in the conversation
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!