Category: react

React components and class properties

React components went the long way from React.createClass through ES2015 powered React.Component to React.PureComponent and stateless functional components. I really enjoy the idea that we don’t have to “hack” the language anymore, at least not that much as we used to. The progress in this department is quite clear and brings not always obvious benefits. Using constructs build into to the language/transpiler instead of relying on framework’s factory functions or constructors accepting huge configuration objects future proofs your code.

Reduce side effects in React/Redux

Pure functions are functions which for certain input always returns the same output without modifying its surroundings. So, they are free from side effects. Because of that feature they are easy to test and highly reliable part of your system. Why only a part? There is a lot of different side effects and it’s more probably than not that your app is full of them. Every DOM mutation, API request, pushState or even console.log is a side effect. It’s hard to imagine an useful application without side effects.

Use RxJS with React

At first sight RxJS is blown up lodash but for dealing also with async. In reality it’s so much more than that. With a few simple operators you can implement Redux-like state machine, schedule animation or deal with any type of events no matter whether it’s WebSocket message or filling in the text input.

The problem of Flux

On 16th December I had a pleasure to give the presentation about Flux architecture pattern on ReactJS Wrocław meetup. Flux is well known in React community and has many different implementations not without reason. After short introduction I pointed out 7 common problems and compered how different implementations are trying to solve them.