Fork me on GitHub
#reagent
<
2018-02-09
>
fabrao00:02:23

Hello all, I´m using soda-ash and I want to know what is the as={Segment} in <Sidebar.Pushable as={Segment}> mean? How to convert to reagent stuff?

beetleman00:02:29

from reagent you can use it like

[:> (.-Pushable Sidebar) {:as Segment} "here you put yout children components" ]

fabrao00:02:09

Do I have to use [:> ... if I already using soda-ash wrapper?

beetleman00:02:42

i never use soda wraper:/

fabrao00:02:18

like [SidebarPushable {:as <something>}]

gadfly36100:02:29

@fabrao no, you dont use :>

beetleman00:02:40

i think its done for you:D

fabrao00:02:35

@gadfly361 so how do I convert to clojurescript Sidebar.Pushable as=...?

fabrao00:02:28

what is the converting for [SidebarPushable {:as <something>}], what do I use in <something> ?

beetleman01:02:17

did you try [sa/SidebarPushable {:as sa/Segment}]?

fabrao01:02:38

I tried {:as (reagent/as-element [sa/Segment])}

beetleman01:02:07

but i think you need import Segment from cljsjs.semantic-ui-react and use it.

beetleman01:02:28

not from soda-ash

fabrao01:02:17

I think not using as will be ok

fabrao01:02:32

is not a type convertion?

gadfly36101:02:30

@fabrao {:as "Segment"}

fabrao01:02:40

ok, gadfly it´s something I couldn´t imagime lol

gadfly36101:02:30

@fabrao nvm, think i am mistaken .. one moment

gadfly36101:02:27

there is probably a better way to do this, but think it is actually {:as (aget js/semanticUIReact "Segment")}

gadfly36101:02:08

Using "Segment" will make the html tag literally be a segment... whereas doing the aget thing will create a div will the proper classes (i.e. "ui segment")

beetleman01:02:35

@gadfly361 is any way to pass reagent compoent here?

beetleman01:02:14

somethink like

(defn foo [props]  ........ ))
`

gadfly36101:02:01

I would have tried the same as what @fabrao has already tried, so seems like you need to use the react version of the component .. so if as-element and reactify-component dont work, i am at a loss.

beetleman01:02:46

mby reagent/as-component?

gadfly36101:02:19

@mateusz.probachta, i don't think the :as is a free-form component .. i think it parses it and adds appropriate classes depending on which specific semantic ui component it is .. this is just a specific thing about semantic ui react i think (but been a long time since ive thought about semantic so could be wrong)

gadfly36101:02:17

@mateusz.probachta i believe as-component and as-element are the same, one is just a legacy name

beetleman01:02:33

i never use react.sementic-ui

fabrao01:02:41

My brain freezed, high level conversation 🙂

beetleman01:02:49

oooo, thank you:D

gadfly36101:02:51

@fabrao I apologize for not having an elegant answer, but i would try {:as (aget js/semanticUIReact "Segment")} and see if that works for you

fabrao01:02:28

thank's for your time

fabrao01:02:42

lol the same question: "I am currently using soda-ash ( a reagent adaptation of semantic-ui react). While dealing with sidebar there is 'as' prop that needs a string/function ( a react component). here's what i am doing [sa/SidebarPushable {:as (r/reactify-component [sa/Segment])} [sa/Sidebar {:as (r/reactify-component [sa/Menu]) :vertical true :inverted true :animation "overlay"} [sa/MenuItem {:name "Strategies"} [sa/Icon {:name "puzzle"}]]]]"

deg07:02:15

Side question about gadfly361 [3:23 AM] @fabrao I apologize for not having an elegant answer, but i would try {:as (aget js/semanticUIReact "Segment")}` and see if that works for you` I recently dove into React Native and have read a bunch of existing projects. and keep seeing folks use aget on ClojureScript objects. I had understood that this was discouraged, since it is fragile in advanced compilation. Has something changed? Or, when is it ok to use? (I've been using oops.core\oget and ocall instead. Am I being correct, or just overly cautious?

danielcompton10:02:41

@deg aget should only be used on arrays, as simple as that :)

danielcompton10:02:07

There’s a warning you can add to your builds to detect bad use of aget.

beetleman11:02:07

for objects you should us: (.-bar foo) => foo bar or (.. foo -bar -baz) => foo.bar.baz

beetleman11:02:37

but in clojurescript aget sould be ok because it is translated to (aget foo "bar" "baz") => foo["bar"]["baz"]

achikin11:02:45

How to figure out which one of your components does not have a unique key?

achikin12:02:52

I got error messages Warning: Each child in an array or iterator should have a unique "key" prop. from time to time, but can't figure out where does it come from.

tatut12:02:36

check your fors and maps are you providing a key for each element?

achikin12:02:23

The issue is that I have pretty complicated form with lots of fields, which is generated, so I can't check each of them by hand. I'm looking for a more general solution which ideally would print out the element in question.

mikerod15:02:54

@deg @mateusz.probachta Instead of aget use goog.object functions for field access. It’s explained here https://clojurescript.org/news/2017-07-14-checked-array-access

justinlee18:02:30

I’ll also mention the cljs-oops library which makes goof.object access much easier

beetleman18:02:21

@deg i did not noticed oops lib in your comment. Its rly nice way to deal with js interop (I reading cljs-oops docs now)

theasp18:02:27

Is there a framework that works well with core.async?

justinlee22:02:41

@theasp i’m not sure what you are asking exactly (?)

justinlee22:02:37

@faxa the hardest part is usually just importing the library and using it. once you have a handle to RGL and widthProvider, you could translate that code pretty straightforwardly i think

justinlee22:02:18

the only magic will be when you use ReactGridLayout, which will look something like :`[(reagent/adapt-react-class ReactGridLayout) {props} children]`