Book review: Learning React

After starting my trip in Web land with learning Javascript, the next step was figuring out which framework to use. I went for React. I needed to learn the good practices of React. Enters this book.


I started the book with no knowledge of React, except that I wanted to use it. First React is perhaps one of the better behaving citizens in the JS world, as it constrains you in terms of configuration. You can still write a full React app without the React scripts, but it’s scary. Really scary. The drawback is that lots of people will tell you they don’t support the React app. Actually, they don’t support anything, more or less, JS is really a jungle that has grown more than wild…

Anyway, back to the book.

First, the author sets the environment in the first few chapters. We start with the tools around React and the events, nothing really fancy, but good to know. Then we move in the second chapter to modern JS and tools from ES6 (we are now far further than version 6, but lots of tutorials still use old style JavaScript, so it’s good to have these good practices. The third chapter tackles quickly the concept of functional programming for JS, which mainly use callbacks as much as possible. The book handles this quite well, and throughout the rest of the chapter, using callbacks is never a reason to botch readability for space.

We now get to the React specific parts. After a chapter on the way React works, with a simple introduction on React skeleton, we move to the part where we forget about all these elements (we don;’t really need them, although it was nice to know about them). We have here an introduction of Babel, but I feel the role of Babel is understated here, as well as webpack’s. The problem here is also that we stop using React development tools, where everything is handled properly and under the hood, and straight into the ocean of Webpack. There are far too many shortcomings in this ocean, as I stated before, to make a beginner jump there without any proper training. Oceans are dangerous, far more than a pool where you can walk!

In the far too small chapter on props, states and refs, unfortunately, there are no talks about the current practice for references (no mention of createRef). I liked the part on property validation, although it’s far less deep than other books I’ve read. The API to initialize state from props in the book has also been deprecated, so all that section is outdated.

The outdated APIs go on in chapter 7, as the lifecycle is now different. A small section is dedicated to High-Order Components, which I have to say I struggled with at the beginning, until it clicked a few days after reading it (so definitely an indication that it is too small). There then a section on Flux, which should have been integrated into chapter 8, as it tackles Redux, a library that implements some aspects of it.

Chapter 8 and 9 should have been written before the one on state, I think. When I read the book, I started developing an app, and used a bunch of practices that Redux basically deprecates (I had to use lots of references, sharing states, which was a mess) as it gives a better view on an application… state. I struggled there as well, because the example was not clear enough on what we really want to achieve and what it could be useful for. The presentation of React-Redux is more outdated practice, as the code doesn’t even work anymore due the deprecation of the Context API. Still, the provider and connect sections are the only one working (the more “advanced” parts that are now actually beginner sections!).

As we approach the end of the book, we finally talk testing. I think testing JS is quite hard as you are rendering a DOM but you still want to test the actions, so for someone not used to web document, it’s quite a different way of thinking. This is definitely a reason for making this chapter the first one after presenting the environment as testing is central to any big development (or at least should be). As such, I still am not enough at ease with tetsing in JS, and I’m sure if this was presented earlier and used in all the other sections, then I would understand this way of tetsing better, and I will probably have understood many concepts more quickly. After all, tests are documentation as well.

Chapter 11 tackles how you can change pages, and something that wasn’t clear to me is that even without a HashRouter, you are still not changing pages, so all states (component and redux) are kept when navigating, which came as a surprise, as I thought it was not the case when reading the book!

Finally, there is a chapter about react on the server, which I didn’t really read because some of the packages I needed forbade rendering on the server. As such, and after all the code in the book that was outdated, I didn’t want to get a wrong idea of rendering on the server. It was also something different for me, as the rest of the book is on the browser, and this is on the server, which behaves differently. As my backend is not written in JS and I don’t have a plan for it, it made sense to just have a quick browse than a good read.


Good and yet failing because JS world moves too quickly for a book. Actually it probably moves too quickly for everyone (one of the React package I use, Material Design, has required JSS 10 for several months now, since the release of 4.0, but JSS10 is still not available… go figure…).

Still, the style is great, there are some shortcomings in the organization of the book, so if there is a new edition coming out and it’s less than a year old when you see it, you may want to have a read at it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.