Develop Now with ClojureScript for React Native

July 19, 2015

While work continues on the front of adding “proper” support for React Native to the ClojureScript toolchain (see an overview summary here), there is nothing stopping you from developing a ClojureScript React Native iOS app today.




The ClojureScript toolchain work has to do with making the DX seamless with respect to React Native JavaScript lib consumption. Perhaps other end-user benefits will fall out with respect to Google Closure Optimizability, but that's not necessary in order to build an app.

The high level strategy that can be used is to have React Native's packager emit concatenated JavaScript, followed by layering on ClojureScript. This is all described in detail in the Ambly Wiki in the ClojureScript React Native Quick Start guide.

A couple of issues have recently been sorted in this guide, making the approach more viable:

  • There was a race that can be avoided by making use of RCTContentDidAppearNotification.
  • A requirement that the user tap the UI upon initialization can be eliminated by sending a message to the React Native bridge.

The QTTT React Native port has been updated to reflect these changes and so has the Ambly guide.

Given this, it is certainly possible to start developing—and even produce a shippable app. And later, when the ClojureScript tooling is ready, it should be a relatively simple matter to switch to using it.

Update July 23, 2015—I've added an online demo illustrating what it looks like to develop using this stack:

 




 

Tags: React Native iOS ClojureScript