Fork me on GitHub
#fulcro
<
2021-12-28
>
Mark Wardle21:12:38

Hi all. I am looking at nested routers and have spotted @holyjak ’s https://github.com/holyjak/fulcro-billing-app/ which has been very useful. There, I see the use of comp/factory and comp/computed-factory - which has led me down greater understanding of passing computed data/closures vs props as second parameter. But I see that in those examples, not all take advantage of passing computed props and clearly computed factories work fine passing through props if no other parameters are included. Which then leads me to ask the question, why isn’t computed-factory the default - is it simply an optimisation to avoid wrapping?

lgessler01:12:52

that's always been my assumption, yeah--`computed-factory` does a little bit of extra work and otherwise directly relies on factory to do everything else: https://github.com/fulcrologic/fulcro/blob/develop/src/main/com/fulcrologic/fulcro/components.cljc#L788L802

👍 1
tony.kay01:12:37

Factories allow react children. We don't use that much in Fulcro, so yes, perhaps the computed factory should be the default, but for legacy reasons the original factory was written to take props and varargs children.

👍 1
tony.kay01:12:56

so computed-factory has one extra arg: the computed props, then children

Mark Wardle08:12:26

Makes sense - thank you!