Fork me on GitHub
#reagent
<
2020-06-03
>
Eliraz09:06:59

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

Eliraz09:06:08

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

Eliraz09:06:15

this one doesnt work

Eliraz09:06:38

but this one:

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

Eliraz09:06:55

but it won't take the props

p-himik09:06:46

What "doesn't work" mean?

Eliraz09:06:26

I get the following

Eliraz09:06:49

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

Eliraz09:06:08

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-himik09:06:35

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

Eliraz09:06:16

so overall it should be working with the :> ?

Eliraz09:06:53

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

Eliraz09:06:16

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

p-himik09:06:30

It should work just fine.

p-himik09:06:10

What is cui/Button?

Eliraz09:06:43

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

Eliraz09:06:49

this is how I require it

p-himik10:06:57

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

Eliraz10:06:40

Yes I have. the there provider is optional

Eliraz10:06:57

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

Eliraz10:06:16

okay you are correct

Eliraz10:06:25

something is off

Eliraz10:06:33

the ThemeProvider is not optional as they say in their docs

Eliraz10:06:09

Wow thank you for your time man

👍 8
Eliraz10:06:20

I truly appreciate it