December 02, 2018
For some time I wanted to try React to understand ideas behind it better and to see how they work in practice. So I’ve implemented Physical Presence Calculator and these are my impressions. I have to admit this is not a comprehensive analysis and I don’t recommend to rely on it to decide if React is suitable for your tasks.
Turned out using a complex framework is not so useful when all your UI is custom and has only a handful of reusable components. From my experience with Angular it works better when you can create small reusable components for UI elements like buttons, tables and use them in multiple places. It saves you work, avoids code duplication, and allows to achieve consistent look.
One of the main React ideas is that you don’t update UI incrementally but describe it in declarative way. When your app state changes, React figures out what DOM elements should be updated and how. Turned out this approach is a poor fit when you have many small UI elements like days in a calendar. I had to do extra work to make mouse hovering in calendar acceptable.
Where I agree with React philosophy is in creating small components to manage complexity and to let the components work with limited data. Though concrete implementation in React still feels clunky as direct child references are discouraged and child-to-parent flow is manual.
Overall I think React has its use but it’s not as good as it is promoted. Even though I’m sceptical about React and my experiment didn’t change my mind, it still feels like reactive programming should be so good. The only reason it’s not great is that I’m not doing it correctly.