Fork me on GitHub
#reagent
<
2020-12-16
>
caleb.macdonaldblack23:12:19

const CustomEditor = ({ value, onChange }) => (
  <HtmlEditor
    options={options}
    value={value}
    onChange={onChange}
    render={({ editor, view }) => (
      <div>
        <MenuBar menu={menu} view={view} />
        {editor}
      </div>
    )}
  />
)

caleb.macdonaldblack23:12:31

How do I express the render function here in reagent?

caleb.macdonaldblack23:12:02

I have MenuBar and menu defined

caleb.macdonaldblack23:12:42

[:> HtmlEditor {:options  options
                     :value    @value
                     :onChange #(reset! value %)
                     :render   (fn [props]
                                 (js/console.log props)
                                 [:div
                                  [:> MenuBar {:menu menu :view (o/oget props "view")}]
                                  [:> (o/oget props "editor")]])}]]))

caleb.macdonaldblack23:12:00

This is what I’ve tried so far.

caleb.macdonaldblack23:12:21

Looks like reagent doesn’t like the js objects in hiccup

p-himik01:12:34

Wrap [:div ...] in reagent/as-element.

Felix M23:12:21

Hi, is it possible to sprinkle reagent (or re-frame) components into a server side rendered monolith without going full SPA? #re-frame

clyfe13:12:51

Depends what you mean by components; if "mini SPAs embedded in page", yes for reagent, and yes with limitations for re-frame (limitations because global app-db); if "DOM attached behavior a-la StimulusJS or Vue.js" no.

Felix M16:12:03

Thanks, that's good to know. Yes I was aiming for the Vue.js style of sprinkling in components.