Clojurians
#re-frame
<
2017-02-22
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

zak16:02:35

I'm having trouble using a local ratom in a component, much in the same way as the todo-input does with its title in the todomvc example (https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/views.cljs) In a component, I have an input that mutates the ratom and can dispatch an event to update the original prop in the app-db. All of that works fine, but when the component is re-rendered, the ratom doesn't get re-created and the component ends up displaying nothing. Other sibling components getting data from a parent's subscription show the new value just fine Apologies if this is more suitable being directed to #reagent

musheddev16:02:41

@zak my guess is this is form-1 vs form-2 view issue. In a form-2 component the inner function which is being returned is what is will be rendered and the stuff above it will only be called once. You could place your atom creation inside that function or switch to a form-1 by returning the hiccup instead of a function that returns hiccup.

zak16:02:54

I did try moving the ratom let binding into the form-2 inner fn, but it didn't seem to have any effect. The todomvc example uses form-2 and has the ratom binding wrapped around the inner fn, so I'm not sure why that works. For now, I've had success wrapping my inner fn in [], but I really don't see why that's working

musheddev17:02:26

Though the purpose of local ratoms is to persist state across renders, but doesn't need to be in db. By wrapping with [] your converting the form-2 to form-1 because the result is now hiccup.

rnandan27317:02:40

Can we call apps written in re-frame and posh to be progressive web apps? there seems to be similarities?

kauko21:02:31

@rnandan273 I don't see what your choice of libraries has to do with progressive web apps? The way I understand the term, it just means web apps that feel like they're native.

kauko21:02:12

You certainly can use the libraries you mentioned to build something you could call a PWA, but you can also build stuff that you wouldn't call a PWA :slightly_smiling_face: