Fork me on GitHub
#re-frame
<
2017-11-15
>
souenzzo02:11:56

How do I pass a function as a parameter to a component?

jeaye05:11:19

[my-component my-fn] or [my-component #(my-stuff)]

souenzzo13:11:00

But with this I will get a always rerender cenario, not?

lovuikeng07:11:45

Zimpler " Reagent and re-frame are just really nice to work with, enabling to express complex logic in a very simple way" https://clojure.org/stories/zimpler

cmal09:11:38

Hi, if I have a :db key and a :dispatch key in a reg-event-fx, what is the order of :db and :dispatch being applied? Is it guaranteed that the effect of :db comes before :dispatch take place, or the order is not defined?

kasuko15:11:47

You can not assume the :dispatch effect will occur after the db is updated. However, since event handling is async you can trust that the :db effect will update the db before the event handler that was dispatched will run.

cmal09:11:26

I found the answer in Effects.md.

### Order Of Effects?

There isn't one.

`do-fx` does not currently provide you with control over the order in 
which side effects occur. The `:db` side effect 
might happen before `:dispatch`, or not. You can't rely on it.

pesterhazy10:11:56

@cmal, what I do is to pass the (relevant part of the) state to the effect

cmal10:11:55

nevermind , I will write this down and when another day I have a problem on this I will dive into it again. I have already rewrite my app, and now there is no need for an ordered :db and :dispatch.

kasuko15:11:47

You can not assume the :dispatch effect will occur after the db is updated. However, since event handling is async you can trust that the :db effect will update the db before the event handler that was dispatched will run.

scknkkrer22:11:05

Are there any navigation example ?

scknkkrer22:11:27

For ReactNative.