This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-22
Channels
- # 100-days-of-code (1)
- # beginners (51)
- # carry (1)
- # cider (10)
- # clojure (71)
- # clojure-conj (4)
- # clojure-dev (9)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-russia (8)
- # clojure-uk (16)
- # clojurescript (42)
- # cursive (4)
- # datomic (2)
- # emacs (8)
- # figwheel-main (7)
- # fulcro (20)
- # hyperfiddle (5)
- # jobs (2)
- # off-topic (16)
- # om-next (4)
- # onyx (9)
- # powderkeg (1)
- # re-frame (8)
- # reagent (17)
- # reitit (41)
- # robots (6)
- # rum (1)
- # shadow-cljs (54)
- # testing (3)
- # tools-deps (19)
Hi everyone. I'm curious as to which approaches and tooling you think are best/preferred for making mobile apps using ClojureScript? Cljsrn, reagent, Cordova, Expo, etc?
@yogidevbear re-natal is the most mature option out there. Any React wrapper will work with it, but Reagent is the most common.
Cool thanks for the feedback 👍 I was just reading through the homepage on http://cljsrn.org when you pinged me
I made a function that gets me json data from an url. Now I want use this function in other functions that get useful data. I thought I could use promises for that. And with "promesa" library it works. However I get back a promise that seems to be a javascript object. And as such I think I will then have to deal with javascript all over my clojurescript code. Any ideas? Am I on the wrong track with this approach?
@hoertlehner, first, you don't need to wrap the whole thing in a promise
(.then p (fn [r] (prn r)))
remember this will by async
Promises have a tiny API - the constructor, .then and .catch - that's it
await is syntactic sugar for .then
I did a talk on this topic recently: https://www.youtube.com/watch?v=rV1gTJ2wsZg
Hope that helps
If you want to stay closer to clojure, you could wrap everything to use core.async. It can be a bit much starting out, but it can be well worth it.
@U0670BDCH I really just want to receive data, preprocess it, and then return it. And for each type of data this is a little different. So I thought this really just needs asynchronous funciton composition. As I understand the core.async it is more like communication, so not really suited for such simple issues. or am I wrong?
Well, depending on what you do, once you go async, it becomes difficult to get out of async
you could just write a blocking set of statements to do what you're doing, and it will likely be a bit slower. It would be more easily testable as well
but once you go async, you are stuck doing either continuous callbacks, chaining together promises, or using core.async channels (to name a few)
when an event is done in callback based async, it's telling that callback that it's finished. Promises wrap around this concept and offload the callback as something you can define later
core.async is different, in that you're now passing around channels, and you can choose how people get stuff out of that channel
So you're right, it is just communication. However, some people would agree that you can do more idiomatic and functional things with a collection of data that is consumed from a stream
@U0670BDCH I just realize that by passing channel names around it should also be possible to compose functions. I just need to get my brain adapted to such a pattern. Haha
second, the function returns a Promise (a JS object) but that's inevitable because it's an async computation
but what the promise resolves to will be a clojure data structure
@lilactown cljs.core
should be available unless :dump-core
has been set to false
(See https://clojurescript.org/guides/self-hosting)