Do This, Not That! Side-Effect Management in UIs
Functional programming has become popular for building robust, complex UIs. Using React and Redux, for example, alleviates many of the issues commonly found in UI programming. In particular, making changes in state clear and predictable rather than the mess found in earlier solutions. However, there are some problems which continue to be painful. Asynchronicity is one such example, since changes to state which are asynchronous are difficult to predict and reason about. In the Firefox debugger, we have explored two options within the react ecosystem for dealing with this: thunk args and sagas. They take two different approaches to the problem of communicating with an async resource and updating the state. Using a recent refactoring of debugger breakpoints as a case study, we will explore the strengths and weaknesses of each. In the process, we will clarify the rationale behind the patterns and show how we came to our chosen solution. While the talk will be focused on the issue from a front-end/UI perspective, it might prove an interesting inspiration for similar problems in other places!
Subscribe to the Lambda World YouTube channel to be updated when new videos are added.