documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Side effects within calmm-js

Open aksonov opened this issue 8 years ago • 3 comments

I've asked this question within Gitter, maybe it will be useful to add more documentation about it:

Hi! I'm new in FRP world and just found your library. I'm building chat-based app and trying to make my xmpp work in FRP fashion - trying to migrate from redux where i have already too much boilerplate. In redux i have action creator that call xmpp connect function and then change state within xmpp reducer. Now i want to implement the same using Calmm. I've read https://github.com/calmm-js/documentation/blob/master/redux-vs-calmm.md but it seems not have "howto" about doing things "right" in Calmm, but just comparison. I've checked TodoMVC example, but it doesn't look very clear.

In other words how to do properly side effects using Calmm?

aksonov avatar May 17 '16 09:05 aksonov

Sorry, i still doesn't see what is best place to put side effects and how to pass it to React - i didn't found any example with side effect, could you provide some examples with fetch or other side effect?

aksonov avatar May 17 '16 20:05 aksonov

FYI, I'm currently a little bit too busy at work to write examples. I'll try to find some time to write a simple example ASAP, but don't hold your breath. :)

polytypic avatar May 18 '16 07:05 polytypic

ok :) Alteast could I ask some questions about side effects here? For example i need to load user profile after login. Could Profile data be an atom? I need to persist it (including sessionID) to local storage (to avoid login each app run), but also this data should be updated properly after each user login.

So from one side it should be atom (so user may modify it), but from other side it should be updated when user does re-login (i.e. "computed" value)

aksonov avatar May 19 '16 09:05 aksonov