Abstract
React is “a Javascript library for building user interfaces”. The core of React follows many concepts of *Functional Programming*, code composition is one of its main features. In React there are 2 main types of building blocks: **stateful** components and **stateless** components. The former type is defined by elements owning the application logic; this kind of components often is bound to external elements and owns a state. The latter type is composed of **pure** components where all dynamic data is received from their props and no internal state is defined. This approach often produces replication of functionalities in several components; **Higher Order Components** (HoC) is the natural solution for this scenario and is a more functional alternative to traditional React **mixins**. An HoC abstracts component functionalities and offers an easy way to compose them when required making the code more maintainable and avoiding duplicates. During the session we will see how to implements this pattern taking attention on its pros and cons.
Facebook
Twitter
Tweets di @jsconfitFlickr