Fork me on GitHub
#clojurescript
<
2020-03-15
>
Aleksandr Furmanov01:03:21

Hi, I am trying to insert react component (https://www.npmjs.com/package/react-div-100vh) into reagent app. I follow instructions found here https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md#creating-reagent-components-from-react-components The problem is (reagent/adapt-react-class div100vh/Div100vh) throws an exception - Error: Assert failed: Component must not be nil I am pretty new to integration React to ClojureScript and not sure how to approach this. If anyone have any hints – this would be greatly appreciated.

lilactown02:03:40

@aleksandr.furmanov if you’re using shadow-cljs, try ["react-div-100vh" :default Div100vh]

💯 4
Aleksandr Furmanov02:03:43

Awesome, it works! Thanks @lilactown!

dangercoder12:03:07

Im running promesa (https://github.com/funcool/promesa) on nodejs, but i can't seem to deref the promises. Has anyone ran into similar issues? not really sure what to use for heavy interop with promises i clojurescript 🙂 might just go native js.

valtteri17:03:33

Native promises work quite nicely with thread first macro.

(-> (js/Promise.resolve "blaa")
      (.then (partial str "blöö"))
      (.then println))

☝️ 4
valtteri17:03:37

And yes AFAIK deref works only with JVM Promesa because you can’t really block. You need to use alet macro or something similar. I’ve been happy with native js promises though.

p4ulcristian18:03:01

Hello guys! I am trying to use socketcluster which was written in nodejs: https://github.com/SocketCluster/socketcluster/blob/master/app/server.js. I tought I should write this in clojurescript. I got stuck at this one:

(async () => {
  for await (let requestData of httpServer.listener('request')) {
    expressApp.apply(null, requestData);
  }
})();
How can I implement this? for example in core.async. Any help is appreciated 😄