Fork me on GitHub
#re-frame
<
2017-02-15
>
isak01:02:29

are sets fair game to put in the app state in re-frame?

scknkkrer07:02:04

Guys what is an affect ? What is it's role on this big picture ?

qqq07:02:59

affect = impure side effect co-effect = impure code to get data

qqq07:02:32

say hypothetically, you are building a missile command mission control you have a button, which when pressed, fires a missile --> firing the missile = affect you have another view, which is displaying radar data getting this radar data ==> co-effect

scknkkrer07:02:39

Yes I have just read it. Can you give me an example ? Simple, tiny. But explained...

mikethompson07:02:35

An example of an effect?

mikethompson07:02:40

If so, all I can do it point you back to the same docs. They have simple, tiny examples.

mikethompson08:02:14

You'll find that each is "explained" Please be sure to read the docs.

curlyfry08:02:28

@danielcompton Any time plan for re-frame-trace? What are the main things that are missing? And how can I contribute? 🙂 The devtools seem to be a big selling point for redux, and it would be really cool to have something similar for re-frame.

shem08:02:49

re-frisk shows re-frame events in real time in a separate window. how is this different?

elahti09:02:02

doesn't re-frisk only show updates to the app-db?

elahti09:02:17

you can attach re-frame-tracer to subs or events too.

shem09:02:39

re-frisk does show handlers firing

shem09:02:21

you need to open it to a separate pop up for that

danielcompton09:02:33

@curlyfry: I haven't looked at it since Christmas, I'll take a look soon and add some GitHub issues for remaining work

negaduck10:02:04

oh, cool, re-frisk indeed shows the list of events when in a separete popup

elahti10:02:57

oh ok thanks. i just remembered that it only shows you app state changes.

viveke12:02:22

Hi Everyone, I am a android mobile application developer. I am interested in learning "clojurescript react native " using re-natal build tools. Can anyone suggest to learn from the scratch ?

curlyfry12:02:41

@danielcompton Sounds great! Would you have time to flesh out the readme a bit as well? (Features, building, running, contributing)

viveke12:02:40

Can you share the readme ?

mac12:02:34

@viveke http://cljsrn.org/ has a ton of stuff and is continuously updated.

scknkkrer16:02:01

@mikethompson thanks a lot but I mean real world (in action) example. I get it, I thkink.

kasuko16:02:45

@scknkkrer I was about to write a real world example but I checked out the docs you were already linked to and quite literally that example is in there.

kasuko16:02:18

I was going to give you the example of Local Storage. The docs handle it better but writing an effect handler allows you to write values to the local storage while being pure. Then on the other end of the spectrum, providing the local storage via a coeffect allows you to read from the local store while being pure

kasuko16:02:37

by pure I mean pure event handlers

kasuko16:02:02

your effect handler will obviously be impure

scknkkrer16:02:13

You mean, like ajax’ing in the event. A dirty event. It’s not pure.

kasuko16:02:19

Yes, I think an http call in an event is a better example of the need for a effect handler. However I can’t think of an equivalent coeffect example for http calls 😛

kasuko16:02:31

another good example from the docs is handling additional dispatches.

scknkkrer16:02:40

@kasuko, English is not my main language. Sometimes I missed something and get f* up. 😄

kasuko16:02:44

Essentially you want your event handler to only “touch” data that comes in via the arguments and not to do anything other than return a value.

kasuko16:02:11

Therefore things like calling dispatch, or making http calls or writing logs or getting values from local storage

kasuko16:02:14

they are all “bad"

kasuko16:02:10

So we use effects and co-effects to get around that. They move side-effect code out of the event handlers and into other areas that are specifically designed to handle side effects

scknkkrer16:02:16

I know that, they are not safe, and not pure.

kasuko16:02:01

Are you still unsure about something?

scknkkrer16:02:06

I don’t know, give me some time to eat this metadology. 😄 But thanks a lot to you @kasuko.

kasuko16:02:17

No problem

kasuko16:02:36

I know it’s a little confusing but rather than thinking about the effects or co-effects. Just focus on the event handler. If you do anything in them that isn’t using the arguments or returning a hashmap … then most likely you need either an effect or co-effect and it will make sense then.

scknkkrer16:02:45

I am goint to have to do some ajax’ing. 😄 Things get dirty.

scknkkrer16:02:41

For locals, form-based local variables, can I use reagent/atom ? Is it idiomatic ?

curlyfry17:02:31

scknkkrer: Sometimes it can be nice to use a local reagent/atom for state that is truly local (check out https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/views.cljs#L28 for example).

scknkkrer17:02:25

Thanks a lot for your message. I still try to see big picture. I am a quick-learner but I have hurry.

scknkkrer17:02:51

So, I missed some basic details.

scknkkrer17:02:22

@kasuko, I have to figure out how to ajax in re-frame. Can you help me ?

kasuko17:02:30

I have never written an event handler myself. I just use this one for HTTP handling https://github.com/Day8/re-frame-http-fx

scknkkrer18:02:24

Wow, How many years spend on this framework @kasuko ?

kasuko18:02:17

Myself. I have only been programming with re-frame casually for about 3 months and professionally now for about 3 weeks 😛

kasuko18:02:43

Err not programming the framework itself but programming with the framework

scknkkrer18:02:42

Nice, but quick question comes; Isn’t there a post method support on day8’s ajax helper library ?

scknkkrer18:02:45

Here is an answer; Yes it supports post, get and put.

danielcompton22:02:18

Yeah I noticed the reader is a bit threadbare :)