rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
sova-soars-the-sora 2020-06-17T14:10:00.144Z

I have a question about rum/hydrate... it can add functionality to my components that were rendered from the server... so if the component is rendered on the server and then the client hydrates it ... it can override it with the client definition? (the client has {:on-click (code)} for example that would then get loaded?

sova-soars-the-sora 2020-06-17T14:11:09.144700Z

I'm wondering if I need 1:1 data representation between the server and the client or if the server-side rendered page with data is enough to send over the wire... and then load only updates

sova-soars-the-sora 2020-06-17T15:08:27.145Z

how can I include a vanilla js function in my rum code?

sova-soars-the-sora 2020-06-17T16:31:01.145300Z

😄 thanks nevermind... interop.

sova-soars-the-sora 2020-06-17T19:09:11.145500Z

Warning: Expected server HTML to contain a matching <div> in <div>.

sova-soars-the-sora 2020-06-17T19:09:35.146Z

how can i ensure the client sees the same div, it seems like matching key-fn doesn't do it...

sova-soars-the-sora 2020-06-17T20:20:21.146600Z

so yeah... not sure how to make sure rum/hydrate finds the correct components. the example in the guide is too minimal for me to understand what i'm doing wrong ;-;

Jan K 2020-06-17T20:30:03.147500Z

it's the same as mounting the component, only hydrate expect the DOM subelements already present

sova-soars-the-sora 2020-06-17T20:39:34.148Z

On the server I am using rum/render-html maybe that is why?

sova-soars-the-sora 2020-06-17T20:40:51.148300Z

thanks i will take a look...

sova-soars-the-sora 2020-06-17T20:53:39.148900Z

do serverside and clientside HTML need to be identical? or just the component i am hydrating?

Jan K 2020-06-17T20:54:24.149800Z

rum/render-html is the way to go, you just have to render the same DOM as the client would

Jan K 2020-06-17T20:55:51.150600Z

the component has to be identical

sova-soars-the-sora 2020-06-17T20:57:48.151500Z

I think the issue is where I am mounting it. I think I am mounting to a div that is actually a child component...

sova-soars-the-sora 2020-06-17T20:58:15.151900Z

rum/render-html spits out html but does not require a div to mount something on

sova-soars-the-sora 2020-06-17T20:58:27.152100Z

hrm

sova-soars-the-sora 2020-06-17T21:07:59.152600Z

... despacito

sova-soars-the-sora 2020-06-17T21:27:14.153400Z

@jkr.sw thanks bruv! "<div id='rhaq'>" (rum/render-html (all-question-page rk-set)) "</div>" (rum/hydrate (all-question-page in-data) (.getElementById js/document "rhaq"))

Jan K 2020-06-17T21:45:09.154500Z

@sova You can also do (rum/render-html [:div#rhaq (all-question-page rk-set)])