This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-02
Channels
- # announcements (7)
- # aws (3)
- # babashka (132)
- # beginners (38)
- # calva (3)
- # chlorine-clover (6)
- # clara (1)
- # clj-kondo (20)
- # cljs-dev (24)
- # cljsrn (9)
- # clojure (76)
- # clojure-dev (1)
- # clojure-germany (4)
- # clojure-india (2)
- # clojure-uk (24)
- # clojurescript (15)
- # conf-proposals (1)
- # conjure (114)
- # cursive (3)
- # fulcro (63)
- # graalvm (1)
- # helix (2)
- # joker (10)
- # juxt (1)
- # local-first-clojure (2)
- # meander (9)
- # off-topic (97)
- # rdf (4)
- # re-frame (7)
- # reagent (16)
- # reitit (1)
- # rum (9)
- # shadow-cljs (48)
- # spacemacs (3)
- # tools-deps (3)
- # vim (30)
- # xtdb (10)
Interesting react useWebsocket hook -- could be an alternative to something like sente if your app is structured around hooks already. https://www.npmjs.com/package/react-use-websocket
When I am passing a deps vector to use-effect, do I need to (cljs->js my-vector) ?
No, if deps is not an array Rum transforms it into array with into-array
. Might be a good idea to add this into docstring for hooks
How can I use an external imported React component in Rum? This is my ns code:
(ns
(:require [rum.core :as rum]
[goog.dom :as dom]
["react-moment" :default Moment]))
And this is how I’m trying to render it:
(rum/defc time-component []
[Moment "1976-04-19T12:59-0500"])
This does not work as expected. This is how the component would look in JSX:
import Moment from 'react-moment';
export default class MyComponent extends React.Component {
render() {
return (
const dateToFormat = '1976-04-19T12:59-0500';
<Moment>{dateToFormat}</Moment>
);
}
}
What’s the Rum equivalent?@amalantony untested, but I would think:
(rum/defc time-component [] [:div (rum/adapt-class Moment {} "1976-04-19T12:59-0500"]])
@laheadle That works, thank you!
Will adapt-class
work for isomorphic server side rendering as well?