Fork me on GitHub
#reagent
<
2016-06-03
>
mikethompson00:06:11

@mhr: Notes in response: - Yes, "spreadsheet model" (javlin) is FRP. - re-frame tries to be just-enough FRP, but no more. - If you definitely want to use Datascript, then Posh might be a good fit for you.

mikethompson00:06:47

DataScript is certainly a good database if you need "graph database" kinda queries. On the other hand, for a great many cases, a good old map is good enough.

martinklepsch11:06:26

This is a bit far-fetched but has anyone considered making reagent render clojure.xml instead of hiccup? I'm thinking it might be nice to be able to customize the hiccup parsing, e.g. parse a class but then use inline styles associated with that class.

pesterhazy12:06:47

reagent renders to react elements, so I guess what you would want is to add a react backend? But not sure why you want that

pesterhazy12:06:11

or am I misunderstanding?

martinklepsch13:06:26

right now: hiccup -> react elements my suggestions: hiccup -> customizable transform -> clojure.xml -> react elements

rohit13:06:01

@martinklepsch: afaik, clojure.xml is only for clojure and not clojurescript.

rohit13:06:22

do you mean similar datastructures as clojure.xml?

martinklepsch13:06:19

@rohit: yeah, clojure.xml is more like an example of a more low level structure, the bits needed to render react elements from clojure.xml data wouldn't be hard though

rohit13:06:11

@martinklepsch: i see the benefit of atleast the use case you present.

rohit13:06:09

i guess you can also achieve that by having a map from class name -> style and then doing a lookup on that class name

rohit13:06:32

so something like react-native’s StyleSheet

martinklepsch14:06:17

@rohit: where would you do that lookup?

rohit14:06:51

@martinklepsch: when you are creating that hiccup

martinklepsch14:06:44

right but then I'd have to do it on a per component basis & traverse nodes or traverse the entire tree y? There's no hook for this kind of thing

martinklepsch14:06:36

I'm not sure about applications of this besides the inline styles stuff but it feels like a generalization type thing that allows people to explore more weird ideas 🙂

rohit14:06:38

makes sense.

rohit14:06:56

so basically you expect to call a function before the react component is created?

martinklepsch14:06:21

@rohit: yeah, essentially that's it

rohit14:06:26

and only for type-1 components, right?

rohit14:06:06

its certainly not a big change but I guess you’ll have to convince the reagent maintainers about it

martinklepsch14:06:06

why would it only be for type-1 components?

rohit14:06:53

@martinklepsch: for type 2/3 you aren’t really returning hiccup. you are returning a function or a class

rohit14:06:23

and the properties for those are very specific

martinklepsch14:06:26

right but these also use the hiccup transformation somewhere, no?

rohit14:06:09

thats true.

rohit14:06:30

@martinklepsch: i’ve got a hack for your use case

rohit14:06:01

template is reagent.impl.template

rohit14:06:35

you can check is x is a map, and if it has a key called class

rohit14:06:09

this code should work with the latest alpha

rohit14:06:17

but obviously this is a hack

thomas15:06:38

Hi, each time I press the “enter” key my page reloads 😞 any idea how I can avoid that?

thomas15:06:31

hmmm I added a (.preventDefault e) to my code...

thomas15:06:44

that seems to have gotten rid of the reload of the page

thomas15:06:26

yes. that does the trick… just put it at the right place though 😉

jjfine19:06:59

i think i avoided that enter key reload problem by not having any of my forms be actual <form>s. but now i'm thinking there's probably a reason i shouldn't have done that. can anyone think of a reason why it's a bad idea to not use <form> tags?

gowder19:06:32

Can anyone point me to a solution to a (very minor) annoyance? I'm working on an app with some params sent via URL string and routed with secretary and stored in a reagent atom (which is initialized to nil), and every time the code is recompiled via figwheel, it reinitializes the atom and I have to hit reload to get the values I want to test/mess with back in. I suppose I could hard code them, but I'm wondering if there's an obvious solution for this that I'm just not thinking of? :-). Thanks!

darwin19:06:42

@gowder: familiar with defonce? that should survive namespace reloads