Fork me on GitHub
#rum
<
2017-02-06
>
leov14:02:49

а что такое did-remount?)

leov14:02:03

*hm. what is did-remount?

leov14:02:17

in rum callbacks? I cannot find this calllback in original react

Niki14:02:31

it should’ve been called will-remount

Niki14:02:41

analogous to componentWillReceiveProps

leov15:02:57

>_< trying to learn both react and rum at the same time) each has its own state, to my understanding >_<

Niki15:02:43

They are called the same but work differently

leov15:02:32

what is the main goal of rum state as compared to react state? (I think I'm starting to have more or less of an idea what is react state - it keeps some javascript objects under the hood, applying callbacks during unmounting and remounting components during virtual dom to dom diffing)

leov15:02:47

(will read rum source in a couple of hours, I guess)

leov15:02:51

(also are mixins equivalent of wrapping a component with another components? Say, I have 3 mixins = 3 wrappers)

Niki15:02:53

Same, actually: keep track of stuff local to component

leov15:02:06

stupid question - could react state be used?

Niki15:02:20

Main difference is that Rum state immutable

Niki15:02:08

Sure, (:rum/react-component state) and (.-setState ...) on it

leov15:02:29

I mean, I'm trying to figure out design goals

leov15:02:01

hm. need to check the source code)

Niki15:02:28

Mixins are not wrappers, rather, they are lifecycle callbacks

leov15:02:49

yes, but component can have 4 mixins. I figure, they will be called in an order

leov15:02:14

of definition. so can I during compilation rewrite it as an equivalent of 4 wrapping components, that will do the same

Niki15:02:29

Mixins stack on top of each other

leov15:02:39

(just trying to figure out what do react users use in stead of mixins)

Niki15:02:57

React users use React class

Niki15:02:13

It has same lifecycle callbacks as Rum mixins

Niki15:02:26

Also, they have mixins in React too

Niki15:02:58

So React has two ways to specify lifecycle callbacks, while Rum has only one

leov15:02:02

(I'm just curious of theorical equivalence)

Niki15:02:02

Simple :)

leov16:02:40

can I return my own state in rum did-mount callback, or I should only assoc into it?

leov16:02:28

it seems that callback state to be getting merged with rum internal state all the time

leov16:02:37

(rum/defcs odometer < #_(rum/local nil)
  {:did-mount (fn [state] #?(:cljs {:odometer {}}
                            :clj  {:odometer {}}))
   :did-update (fn [state] state)}
  [state value]
  [:div "state is: '" (str state) "' and value is " value])

leov16:02:06

on mounting it has internal :rum/component, on updating there is no rum/component, however rum/args are still there

leov16:02:19

I see where to get args now)

leov16:02:23

from rum/args)

leov16:02:55

I'll go watch the workshop again.

leov16:02:00

yes, I was basically erasing rum state, probably

leov16:02:09

merging with it works just fine

Niki16:02:01

Yeah don't erase rum internal state please

leov17:02:03

last question

leov17:02:12

how do I (you?) debug rum components?

leov17:02:40

with all that threaded (incapsulated?) state I can't REPL into rum component state

leov17:02:04

I guess I cannot reuse facebook's chrome plugin

Niki19:02:17

Chrome plugin works, more or less

Niki19:02:31

You'll see ClojureScript maps though

Niki19:02:42

I debug with println