Fork me on GitHub
#fulcro
<
2020-02-26
>
zharinov06:02:14

Hi folks, I'm not experienced anough Fulcro, but is it possible for me to create alternative render format (e.g. something like this: {tag: :div, :attrs {}, :children [...], [:react-id ...]}), which then can be used on jvm-based Clojure Fulcro app with state stored inside simple atom? I'm completely okay to full re-renders, just want to have component tree rendered for each state transitioned.

tony.kay15:02:47

@s_zharinov Fulcro already can do server-side rendering, and it stores state in an atom. See http://book.fulcrologic.com

zharinov15:02:07

Thanks, looks like I've figured out how to "render" into data-structure, in the same manner render-to-str does. My point was to create "headless" fulcro instance and run unit tests against it, without any JS-side machinery.

eoliphant17:02:35

cypress is nice

tony.kay15:02:41

this is not unit testing, but for testing UI I think it is about the best thing going right now: https://www.cypress.io/

8
zharinov10:02:20

That's exactly what I want, but with unusual approach: what if we can completely "simulate" application entirely in JVM. Once it's possible to run app with "dummy" DOM/widgets/etc, it should open the possibility for stateful generative testing, as well as coverage reports.

zharinov10:02:32

I found one mention from docs: http://book.fulcrologic.com/#_building_the_app_state_on_the_server. It isn't recommended approach, but still want to try.

tony.kay21:02:51

all of the code is CLJC so you can do exactly that sort of thing. Technically you can plug in alternate rendering (see keyframe-render), and you could make your own replacement server dom lib that has the same API but returns CLJ data structures.

👍 4
jtth21:02:10

Is there a piece of writing somewhere that goes into the differences between fulcro and reagent/reframe and their respective affordances and philosophies? I don’t want to start a flame war, I’m just curious.

👍 4
currentoor21:02:26

I gave a talk that explains what makes fulcro different, for non-fulcro people

currentoor22:02:27

the talk goes into more detail, but one of the biggest differences is fulcro is full stack (but any backend is pluggable)

currentoor22:02:29

most stacks only have normalized data stores for the server and store denormalized data on the client (or leave it up to you to normalize and query yourself)

👍 4
currentoor22:02:38

the talk explains better with pictures and examples

jtth22:02:41

hah, i just had that queued up for viewing later. and yeah, that’s the main standout feature. thanks for responding!

👍 4
currentoor22:02:46

also worth considering what the creators of both frameworks were building when they made these tools

currentoor22:02:03

both have been on the defn podcast explaining the origins i believe

jtth22:02:23

ooh, i’d love to hear those. i’ll look those up.