It’s strange, because web development and programming microcontrollers seem to be very different from one another. One is all about crafting slick user interfaces in the comfort of a web browser, with plenty of room to breathe — think dynamic memory, high-level abstractions, and resources that feel practically infinite. The other one? In this world of strict constraints, you’re tinkering at the hardware level, real-time deadlines are the rule, and every byte of memory counts.
If you’ve ever worked on firmware for a microcontroller, you’ve probably felt the pain. As your codebase grows, it starts to look like a plate of spaghetti someone dropped on the floor. Bits of logic for controlling peripherals end up scattered all over the place. Interrupt handlers and state changes show up in the most unlikely places in your code. How we love to make a mess, don’t we? Enough to remind you of your nightmares about debugging and trying to integrate a new feature into the system? Pulling one thread without ripping the entire sweater can be like that.
But what if — crazy as it sounds — we took some of the beautiful ideas of React, that groundbreaking library for web development, and brought them into MCU programming? React embraces modularity, thinking about what to do, not how to do it, and handling state in an explicit, predictable way.