Fork me on GitHub
#re-frame
<
2016-02-21
>
heeton02:02:17

Hey reframers, got a (probably) noob question: how can I use normal reagent atoms in my components? I’ve got a component that just needs to progress through a couple of steps (no submitting or validation, just hiding/showing HTML) and I’m trying to use this (standard?) reagent approach but it’s not working. Here’s my 10-line component - https://gist.github.com/heeton/df2faf7ab374e89ddf16 I can see that the atom is actually getting updated (if I log it afterwards, it has the new :stage2 value), but my view isn’t updating.

heeton02:02:34

I assume I need to use a reaction somewhere? But I haven’t been able to work out where

nberger03:02:17

Hey @heeton your component should be a form-2 component as explained in https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-2--a-function-returning-a-function. You basically need to return a fn that closes over the let bindings and will return your div when called

heeton04:02:09

@nberger: yes! Thankyou simple_smile

nberger04:02:15

Cool, no problem!