May 18, 2018

React Europe 2018

This week I was lucky enough to be part of the React Europe conference in Paris. I would like to write down some of the ideas that resonated with me. To do this I will focus on 3 big themes that seemed to come back in all of the talks.

Context and Suspense

Since React 16.3 Context and Suspense are two new features that will shape the architectures of client side React applications. Context is a feauture that has been around in the React API since quite a while. The use of it however has always been discouraged. A simple example that shows the power of it would be to show how we can simplify data fetching with it.

Suspense is an experimental feature that continues on this idea and offers extra abstractions on the lifecycle of data fetching. Therefore it provides simple-cache-provider. The API offers you abstractions to fetch your data and cache it for future use. Moreover it is a provider that will pass a flag that let’s you check whether or not your data is done fetching.

Apollo’s implementation of GraphQL plays nicely together with these new React features.

The web as just a compile target

With projects such as Lona and React Native Web it is time to see the web as just another target and React as a high level tool that facilitates the implementation of our applications.

Sven Sauleau came to convince us of this by promoting WebAssembly as the next platform. This doesn’t mean JavaScript will disappear but rather that we will be able to use modern languages such as C++ or Rust to compile to WASM where we need the extra performance. For example we have already seen that Unity is doing efforts to support the web as compile target. This still young technology is very exciting in my opinion.

ReasonML

JavaScript is great, it is very versatile and allows you to write proof of concept applications in no time. It was however never made to build large scale applications. This is where languages such as TypeScript or Flow can help you by providing a static type system. While these languages will give you some form of type safety they are still not perfect for client side application development. More recently, strongly typed languages such as Elm and ReasonML are being adopted to provide a better developer experience and quality code. ReasonML is a OCaml dialect that compiles to JavaScript and offers type safety with good JavaScript interop. It is a strongly typed language with syntax that is much more friendly to JavaScript developers than Elm and it enforces immutability. Because of the good JavaScript interop we can use Yarn and thus make use of the whole React ecosystem.