My Wiki!

Reactjs begins

Dev env

Webpack

Project structure

Beginner Tutorial

Good tutorial

Boilerplate

1. Tips and Tricks

Events passing

Compose

compose merge functions:

const hoc1 = ...;
const hoc2 = ...;
const enhance = compose(hoc1, hoc2);
const Component = enhance(BaseComponent);

The same thing can be done with the following.

const Component = hoc1(hoc2(BaseComponent));

implementation of compose is quite simple.

const compose = funcs => funcs.reduce((p, c) => (...args) => p(c(...args))); // this only works if funcs.length >= 2

Navigation