Fork me on GitHub
#reagent
<
2023-03-23
>
Alejandro07:03:01

Do reagent components have to enclose everything in divs? Is there a way to avoid having a div inside of a div when the app gets rendered? UPDATE:

<div id="app">
    <div>
        <!-- the contents of a single component -->
        <!-- a lot of tags here -->
    </div>
</div
I mean, to render directly to the app div when I have one component?
<div id="app">
    <!-- the contents of a single component -->
    <!-- a lot of tags here -->
</div

hkjels07:03:28

[:> [:a] [:a]]

hkjels07:03:41

You mean something like that?

Alejandro07:03:04

I updated the question, added an example for clarity.

hifumi12308:03:05

I would also guess rendering a fragment into div#app

hifumi12308:03:33

i.e. your root component is just something like

[:<>
 [a-component]
 [other-stuff]]

Alejandro08:03:28

@U0B1SDL67, ah, I didn't recognize it as reagent's syntax. What does :> mean? Never used it, nor :<>

Alejandro08:03:44

@U0479UCF48H, that's what I'm looking for, thanks.

hifumi12308:03:40

For reference, :<> is a syntax shortcut for React fragments. :> is a shortcut for r/adapt-react-class. You typically use :> when you are using a JS React component

hifumi12308:03:32

Unfortunately the reagent docs don’t concentrate this info in a single page, but here are sources for both of these things. https://github.com/reagent-project/reagent/blob/master/doc/ReactFeatures.md https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md

❤️ 2