Artem Yarulin edited this page Jan 6, 2016 · 2 revisions

Welcome to the om-next-cross-platform-template wiki!

FAQ:

Why Om-Next?

It makes following things easy:

  • Optimistic updated is MUST HAVE feature on mobile. Careful state handling in Om-Next makes it possible
  • Fast communication with backend - Om-Next queries allows you to request all the data in one call
  • Multiple entrance to the app: search results, app start, app recover after it was purged from the memory, etc. We should be able to change app UI state quickly to any form

How does hot reload works?

First we build REPL app, which is a simple RN application. Then we run a Figwheel which is a standard hot reload tool in ClojureScript world. REPL app then tries to connect to the Figwheel HTTP endpoint, fetch the file and eval it. After that figwheel starts to maintain WebSocket connection and reload the file if it has changed in file system

How does state sync works?

First we subscribe to any state changes using standard add-watch function. Whenever state has changed - we call special HTTP handler, which append a line to a file with a state. This line would look something like reset! app-state [new-state]. As figwheel monitoring file system changes - it will distribute those changes across the clients. In reality it's a bit more complicated

How can I connect my Emacs/Vim/Cursive to nrepl?

Just start the repl session line repl, during run it will notify you about nrepl port

How can I test it on a device?

First check the docs from RN, iOS and Android. Then make sure that you've changed and put a right IP address to project.clj in :figwheel :websocket-host section and to the src/repl/repl.cljs to the :base-url. Make sure that you've recompiled repl app: lein clean && lein cljsbuild once repl

How it's different from natal, re-natal, boot-react-native?

Both natal and re-natal are bootstrapping tools: They abstract you from the interaction with React Native which makes starting very easy. natal using Ambly under the hood, which is a hand crafted REPL into JavaScriptCore. re-natal using awesome figwheel-react-native which allows using Figwheel for hot reloading/repl/etc. boot-react-native relays on react native packager, it compiles CLJS to JS, tune it a bit and viola - no hacks, no workarounds, no other problems that others solution have caused by avoiding the packager.

This project (and related ktoa) on the other hand tries to keep those things on a top:

  • No abstraction from React Native - it's essential to know it and use it in a right way
  • Cross-platform development - it should be possible to reuse components or part of the logic inside the browser and on mobile. With Om-Next and idea of queries it's almost trivial and very desired to reuse such code between platforms
  • Easy integration with existing apps - it should be possible and as easy as possible to migrate the existing app to CLJS

Where I can ask a question?

A lot of discussions happening on #cljsrn channel in the http://clojurians.net

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.