Fork me on GitHub

Hello! I need a hint regarding reagent, initial-values and state. I have a select item which gets populated from a database with users (using a for loop generating the hiccup). After initialization it shows the first user which is standard behavior, however this user is not represented in the state r/atom as the selected user. This happens via :on-change once a user is actively selected. Can I call the :on-change function with the initially displayed value? Maybe there is a completely different approach to this kind of problem? Thanks!


Why not just initialize that ratom with the correct value?


Yeah, that seems possible. I was just wondering if there is another solution. It seemed weird to set the ratom which is supposed to be set by a gui element manually. In case something happens this "correct" value is for whatever reason might not be the value the select object is actually showing. Probably that's just me overcomplicating things :)


You should drive your components with the data. What data there is, the component has to respect it. This way, there'll be no possibility of inconsistencies.