Volodymyr Sapsai

React Impressions

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.

Negative

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.

For some tasks React has poor support. Specifically, for handling escape button and for layout updates during window resize and scrolling I had to ignore React events and use regular JavaScript events. It wasn’t particularly hard but React added extra friction and I don’t appreciate it. Handling input field focus is also clunky but I cannot tell if it is React’s fault or if browsers’ API isn’t good.

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.

Positive

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.

Summary

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.