Fork me on GitHub
#cljsrn
<
2019-10-07
>
Maksym17:10:36

Hey, I was wondering how can I problematically generate components for a view, I tried this but it gives error:

...
[view {:style {}}
        (doseq [[k v] (:sub-list props)]
          [text {:style []} (str k " " v)])
        ]
...
view and text are react-native components:
(ns example.components
  (:require [reagent.core :as r]
            ["react-native" :as rn]))
(def text (r/adapt-react-class (.-Text rn)))
(def view (r/adapt-react-class (.-View rn)))

thheller17:10:38

doseq returns nil, you probably want for?

Maksym18:10:20

I want to create several text components from my sub-list

Maksym18:10:00

yeah you are right, I want for 😄 btw speaking about order, why this code return values in different order than in my map?

cljs.user=> (for [[k v] {:a "a" :b "b" :c "c"}] (str k "--" v))
(":c--c" ":b--b" ":a--a")
I faced this problem before when I was running couple of prn one after another and output was in wrong order. Why does it happen?

thheller18:10:53

maps are not ordered, they do not maintain insertion order

Maksym18:10:16

right, this is obvious, how could I forgot