WiD - Universal React Components

Universal React Components

Tl,dr: Took a closer look at React Native. Ended with an aproach to render the same React components on native and on web. Call it React Universal Components.

Time for an update: Took some time off of my morphlog project, will come back to that. Instead, I played with React Native. After seeing a great React Europe talk regarding rendering React components to native, web and other React targets, my interest was sparked.

Many puzzle pieces from above.

Sometimes you have to solve a puzzle. Photo by Hans-Peter Gauster on Unsplash.


Along the way, a kind of bootstrap project was created and open sourced. It is set up as a Lerna monorepo, with a universal-components, a spa (single page app for web) and native-app package. The latter two were bootstrapped with Create React App and Create React Native App, so we are using established best dev environments. Right now, we can render reusable components from the universal-components package, to both our targets, mobile and web.

Interesting points

Especially rendering to mobile, with the help of Expo and without any traditional native setup is awesome. No Android Studio or XCode is required.

A trip wire in this setup is reusing existing 3rd party React Native components. These are often not transpiled, so we need to do that ourselves for the web env. For that, I patched them using patch-package, which allows to ‘fix’ npm dependencies reliable in our node_modules.

As mentioned, the project is open sourced an on GitHub, so see for yourself! If you are interested in a deeper writeup, or have any other question, please reach out down there in the comments, or on my twitter.

Published June 30, 2018

Comments, anyone?

Revealing Prisma GraphQL's magic tricks

Prisma is a GraphQL API Layer. Trying it out with one of the available boilerplates gives you a ton of great features, almost feeling like magic. But is it? Let's have a look behind the tricks!