Fork me on GitHub
#reagent
<
2018-12-07
>
Whiskas12:12:38

Hey guys, what is the proper way to use JSX components with re-frame/reagent ?

aisamu13:12:23

You may use [:> comp {:props}] for react components, but you'll have to transpile JSX first. There is official documentation for that on the cljs compiler docs, and you can find :> on reagent docs

hansw14:12:48

hi all. What is the recommended way of applying error boundaries to a reagent 0.8.x app?

hansw14:12:45

googling i came upon this: https://github.com/reagent-project/reagent-cookbook/wiki/Error-Boundary but it seems outdated because recalcitrant seems to geared towards React 15.

hansw14:12:37

And its demo uses reagent 0.6.0

orestis16:12:45

I’m interested in this @hans378 - can you write some pointers?

hansw16:12:04

note the [error-boundary [comp1]]

hansw16:12:42

that is where you wrap your root-component inside a react-errorboundary

hoopes16:12:34

is there a function in reagent to add props to an element? if i wanted to add a :key prop from a function, for instance

hoopes21:12:24

another way to ask that question - is there a way to mark a component as "all of my children are static, you do not have to warn me that they all need a key - i promise to add a :key in a for loop!". Adding the key metadata to every element is like 20% of the text in my views (slight hyperbole)

mikethompson21:12:22

@hoopes would this solve your problem? (into [:div] [[:div "hello"] [:div "world"]]) <---- no keys needed

mikethompson21:12:48

whereas this will trigger key warnings ... [:div '([:div "hello"] [:div "world])]

hoopes21:12:55

yeah, i was wrapping material components with something like

(defn grid [props child & children]
   [:> Grid props child children])

hoopes21:12:16

and i think i'm applying the children argument incorrectly (where the destructuring turns it into a seq?)

hoopes21:12:58

but i did see your answer to that SO question, and didn't understand how i wasn't doing something verrrry close to that, but i'm pretty sure i'm just making dumb beginner mistakes

hoopes22:12:12

damn, i've been a beginner for a while now...

mikethompson22:12:43

Test:

(defn grid [props child & children]
   [:> Grid props child (vec children)])     <--- note use of vec

mikethompson22:12:20

Test #2

(defn grid [props child & children]
   (into [:> Grid props child] children))

mikethompson22:12:55

Dunno enough about Grid to know which of these will be right for you

hoopes22:12:16

Uncaught Error: Invalid arity: 3 both of them are giving me this error, but thank you - i will definitely experiment with these

hoopes22:12:28

i was thinking i had to add key to everything

hoopes22:12:40

and i didn't think people would be ok with that πŸ™‚

hoopes22:12:21

it's 5PM EST on a friday - i'm gonna take a break, but thanks again, and thanks for re-frame!

mikerod22:12:18

much later than 5pm for @mikethompson I believe

mikerod22:12:40

oh wait, it’s just a new day

mikerod22:12:47

time zones are crazy

mikethompson22:12:51

9am in the morning here :-)

mikerod22:12:58

🀯

mikerod22:12:16

you are speaking from the future

πŸ˜‚ 1
mikethompson22:12:50

New Zealand is the most futurist.

1
mikethompson22:12:10

11am on Saturday over there

mikerod22:12:58

Thought you were New Zealand actually, but I guess sort of close

mikerod22:12:37

guess have strayed too far away from reagent though, need a #timezone channel I guess 😜

mikethompson22:12:38

We're all "Antipodean"

😡 1