This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-22
Channels
- # beginners (240)
- # boot (23)
- # bristol-clojurians (3)
- # cider (101)
- # cljs-dev (52)
- # cljsrn (17)
- # clojure (212)
- # clojure-dusseldorf (2)
- # clojure-greece (2)
- # clojure-italy (9)
- # clojure-russia (1)
- # clojure-spec (91)
- # clojure-uk (33)
- # clojurescript (164)
- # community-development (23)
- # core-async (24)
- # core-logic (9)
- # cursive (18)
- # datavis (1)
- # datomic (119)
- # emacs (13)
- # events (1)
- # figwheel (2)
- # fulcro (86)
- # graphql (1)
- # immutant (5)
- # jobs-discuss (6)
- # leiningen (19)
- # lumo (46)
- # nyc (7)
- # off-topic (23)
- # parinfer (15)
- # pedestal (3)
- # planck (32)
- # re-frame (48)
- # reagent (75)
- # ring-swagger (13)
- # rum (32)
- # shadow-cljs (402)
- # spacemacs (5)
- # specter (3)
- # tools-deps (11)
- # unrepl (20)
- # vim (135)
- # yada (3)
Is there a standard way to utilize React components in Rum?
@grounded_sage There is not, you can do it manually like (js/React.createElement js/Foo.bar.The.Component props child0 child1)
. Reagent provides a special syntax for this: [:> js/The.React.Component props child0 child1]
, but Sablono (used by Rum) does not provide it
Oh! I will check that out.
The problem I have is I am actually very interested in doing React Native for Web. So I'm actually not needing Sablono theoretically.
Checkout hicada in this case, there is a few ideas to make RN easier in that case with a special config flag
Eg. define all your components in a single namespace and then just write [:Text {:foo "bar"} child0]
and then specify :default-ns
in the hicada config
Have you much experience with RN code in cljs? @rauh
I'm very new to the idea. However looking at the RN4W project I'm convinced it's the way forward so giving it a go.
I tried Flutter the other day. Very impressed. Super quick live reloads. Like 300ms... So very much a figwheel like experience. IDE support is also fantastic.
Think it has a chance of getting developer mindshare?
It looks like a fantastic project. Just react is so far ahead in this space I'm curious where people think it fits in.
Interesting. Even if you were using Cljs?
I mean i use CLJS a lot and I love it. But RN was just a pain to setup and the errors are super tough to debug. With Flutter it was just super easy. And by running a repl()
function on ever reload I had very much an interactive dev experience. To get a nice UI it was just super easy and fast. I also really like tooling with Android-Studio. It's just so easy to get something on the screen quickly
It's super quick to get started in Flutter. If you already have the SDK and Android studio it's <10min to have a starting screen.
Problems I see is not having the reach React has. Targets for desktop, vr. Plus accessibility is a WIP as well. It still needs some work but perhaps it's the better option when people have already fleshed out a prototype and want the perf? Not sure guess we will see.
Sorry I'm still a noob with Cljs/Clj. What do you mean by this Rum, simple overwrite the sablono.compiler/compile-html macro.
?
In your src
directory you create a file: src/sablono/compiler.clj
and write a defn compile-html
that takes the hiccup and calls into hicada and returns the CLJS/JS code
@grounded_sage In that case you will have to wrap your defc
bodies in a call to that html
macro.
When using the hack to overwrite sablono you can just write (defc [..] [:div ...])
instead of (defc [..] (html [:div ...]))
So I just define it the as a defn
with the same body as that macro?
and called compile-html
?
Will be interesting to see if it works. I ended up using Shadow cljs because I was having issues with the library I am using and npm-deps
Looks like Shadow cljs doesn't like this approach
------ ERROR -------------------------------------------------------------------
File: jar:file:/Users/wade/.m2/repository/sablono/sablono/0.8.1/sablono-0.8.1.jar!/sablono/core.cljs
Exception: No namespace: sablono.core found
clojure.core/the-ns (core.clj:4128)
clojure.core/ns-publics (core.clj:4155)
clojure.core/ns-publics (core.clj:4155)
shadow.build.macros/find-macros-in-ns (macros.clj:32)
shadow.build.macros/find-macros-in-ns (macros.clj:30)
shadow.build.macros/load-macros (macros.clj:80)
shadow.build.macros/load-macros (macros.clj:50)
shadow.build.compiler/post-analyze-ns (compiler.clj:44)