helix

https://github.com/Lokeh/helix
fabrao 2020-04-29T01:45:19.031600Z

Hello all, I don´t understand how to use JS interop with cljs, look this:

import GridLayout from 'react-grid-layout';

class MyFirstGrid extends React.Component {
  render() {
    return (
      <GridLayout className="layout" cols={12} rowHeight={30} width={1200}>
        <div key="a" data-grid={{x: 0, y: 0, w: 1, h: 2, static: true}}>a</div>
        <div key="b" data-grid={{x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4}}>b</div>
        <div key="c" data-grid={{x: 4, y: 0, w: 1, h: 2}}>c</div>
      </GridLayout>
    )
  }
}
and
(ns app.componentes.principal
  (:require
   [helix.core :refer [$]]
   [helix.dom :as d]
   [app.lib :refer [defnc]]
   ["react-grid-layout" :default GridLayout]))

(defnc Principal []
       ($ GridLayout {:className "layout"
                      :cols 12
                      :rowHeight 30
                      :width 1200}
          (d/div {:key "a"
                  :data-grid {:x 0 :y 0 :w 1 :h 2 :static true}} "a")
          (d/div {:key "b"
                  :data-grid {:x 1 :y 0 :w 3 :h 2 :minW 2 :maxW 4}} "b")
          (d/div {:key "c"
                  :data-grid {:x 4 :y 0 :w 1 :h 2}} "c")))
giving React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

lilactown 2020-04-29T02:21:36.032Z

try changing your require to ["react-grid-layout" :as GridLayout]

lilactown 2020-04-29T02:22:05.032400Z

it is because GridLayout is empty, which means your require is probably wrong

fabrao 2020-04-29T02:27:14.032800Z

😅 Wrong documentation

fabrao 2020-04-29T02:27:54.033200Z

it works with :as thing

Lucy Wang 2020-04-29T14:03:26.033600Z

created a pr to ease writing css class names in helix https://github.com/Lokeh/helix/pull/45

Aron 2020-04-29T16:49:33.034200Z

is there some specific reason why this channel is not logged on the https://clojurians-log.clojureverse.org/ ?

Aron 2020-04-29T16:49:52.034600Z

I am new around here : S

lilactown 2020-04-29T16:55:57.034800Z

nope

lilactown 2020-04-29T16:59:06.035100Z

I don’t know how to get #helix to participate in that

aisamu 2020-04-30T17:59:43.043800Z

Inviting @logbot to the channel does the trick

lilactown 2020-04-30T18:15:24.044600Z

gotcha thanks!

orestis 2020-04-29T17:25:51.035400Z

Zulip archives it though.

Aron 2020-04-29T17:28:14.035800Z

I am not familiar with Zulip, looks like a slack alternative?