Fork me on GitHub
#reagent
<
2023-01-16
>
ns23:01:57

Hi, I'm building a Clojurescript app with Reagent and there are certain html(hiccup) fragments that I would like to avoid having in the main bundle (basically many variations of the same template which would unnecessarily increase the bundle size plus many more will be added after the app is built). My question is can I have a hiccup fragments stored in static files on server and loaded only as needed?

p-himik07:01:08

You sure can since Hiccup is just EDN. You can fetch it and then return it from a component.

juhoteperi08:01:32

Hiccup elements are just EDN, but Reagent components are usually code so they need to be also eveluated in addition to reading the data. So code-splitting is probably the best choice for many cases.

ns22:01:54

Thanks everyone!