Fork me on GitHub
#rum
<
2020-05-02
>
Lyn Headley01:05:21

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

Lyn Headley12:05:03

When I am passing a deps vector to use-effect, do I need to (cljs->js my-vector) ?

Roman Liutikov15:05:21

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

👍 4
amalantony16:05:53

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?

Lyn Headley17:05:11

@amalantony untested, but I would think:

Lyn Headley17:05:12

(rum/defc time-component [] [:div (rum/adapt-class Moment {} "1976-04-19T12:59-0500"]])

amalantony17:05:08

@laheadle That works, thank you!

amalantony17:05:43

Will adapt-class work for isomorphic server side rendering as well?