reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
Eliraz 2020-06-03T09:29:59.064500Z

hello, I'm trying to use a third party UI library with Reagent, not sure I fully understand when to use :>

Eliraz 2020-06-03T09:30:08.064800Z

(defn hello-component []
  [:> cui/Button {:variantColor "green"} "Button"])

Eliraz 2020-06-03T09:30:15.065Z

this one doesnt work

Eliraz 2020-06-03T09:30:38.065400Z

but this one:

(defn hello-component []
  [:cui/Button {:variantColor "green"} "Button"])

Eliraz 2020-06-03T09:30:40.065600Z

works

Eliraz 2020-06-03T09:30:55.065900Z

but it won't take the props

p-himik 2020-06-03T09:31:46.066300Z

What "doesn't work" mean?

Eliraz 2020-06-03T09:38:26.066500Z

I get the following

Eliraz 2020-06-03T09:38:49.066800Z

TypeError: right-hand side of 'in' should be an object, got undefined

Eliraz 2020-06-03T09:39:08.067100Z

The above error occurred in the <Button> component:
    in Button (created by devcards.main.hello_component)
    in devcards.main.hello_component
    in devcards.main.hello_component (created by DevcardBase)
    in div (created by DevcardBase)
    in div (created by DevcardBase)
    in div (created by DevcardBase)
    in DevcardBase (created by DevcardsRoot)
    in div (created by DevcardsRoot)
    in div (created by DevcardsRoot)
    in div (created by DevcardsRoot)
    in div (created by DevcardsRoot)
    in DevcardsRoot

p-himik 2020-06-03T09:49:35.067200Z

undefined sounds like you didn't provide some required properties.

Eliraz 2020-06-03T09:50:16.067400Z

so overall it should be working with the :> ?

p-himik 2020-06-03T09:51:19.067600Z

Yes.

Eliraz 2020-06-03T09:51:53.067800Z

okay. it's probably something else because the button component has no required props.

Eliraz 2020-06-03T09:52:16.068Z

Maybe Reagent is not so tolerant to third-parties React elements?

p-himik 2020-06-03T09:52:30.068200Z

It should work just fine.

p-himik 2020-06-03T09:53:10.068400Z

What is cui/Button?

Eliraz 2020-06-03T09:53:25.068600Z

https://chakra-ui.com/button

Eliraz 2020-06-03T09:53:43.068800Z

(:require [reagent.core :as r]
            [devcards.core :as dv]
            ["@chakra-ui/core" :as cui])

Eliraz 2020-06-03T09:53:49.069Z

this is how I require it

p-himik 2020-06-03T10:03:57.069200Z

I see. Have you followed through https://chakra-ui.com/getting-started ?

Eliraz 2020-06-03T10:10:40.069600Z

Yes I have. the there provider is optional

Eliraz 2020-06-03T10:10:57.069800Z

I mean, I can use it in js env with no problems

Eliraz 2020-06-03T10:13:16.070Z

okay you are correct

Eliraz 2020-06-03T10:13:25.070200Z

something is off

Eliraz 2020-06-03T10:14:33.070400Z

the ThemeProvider is not optional as they say in their docs

p-himik 2020-06-03T10:16:55.070800Z

Yep. :)

Eliraz 2020-06-03T10:17:09.071Z

Wow thank you for your time man

👍 2
Eliraz 2020-06-03T10:17:20.071300Z

I truly appreciate it