Fork me on GitHub
#fulcro
<
2021-11-15
>
Brandon Olivier01:11:10

When would you load data for a component in Fulcro? I’m not using the router right now, but I’m used to loading data in interceptors with reitit, or just on component mount with plain React. What’s the Fulcro version of doing something like that?

tony.kay02:11:30

Most of my io is done in UI state machines or the routing layer. Usually a combination of the two.

tony.kay02:11:48

Well and also direct user events. You can also use hooks support use-component

sheluchin18:11:22

https://github.com/roterski/fulcro-rad-demo/blob/570047474e301e51f7a01f20e9ef5f3a38398d5b/src/xtdb/com/example/components/xtdb.clj#L7-L12 @pt.roterski I'm not totally sure, but does this break when using something other than jdbc? I'm using RocksDB and I've had to modify it to look for the :main key in the config map instead of using for. I'm not sure if that would be different if there was a connection pool. Maybe doseq would be a better choice anyhow - it's intended for side-effects whereas the for produces a lazy seq. I could just be misusing it :man-shrugging: but I think I have it working for my particular needs right now, just wanted to ask about it.

Piotr Roterski22:11:51

hey @UPWHQK562, thanks for noticing it. Yeah, it looks like it could cause some problems so changing it to doseq seems like a good idea.