reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
caleb.macdonaldblack 2020-12-16T23:23:19.380700Z

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

caleb.macdonaldblack 2020-12-16T23:23:31.381Z

How do I express the render function here in reagent?

caleb.macdonaldblack 2020-12-16T23:24:02.381200Z

I have MenuBar and menu defined

caleb.macdonaldblack 2020-12-16T23:25:42.381400Z

[:> 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.macdonaldblack 2020-12-16T23:26:00.381700Z

This is what I’ve tried so far.

caleb.macdonaldblack 2020-12-16T23:26:21.382100Z

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

Felix M 2020-12-16T23:47:21.386300Z

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

clyfe 2020-12-17T13:51:51.387100Z

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 M 2020-12-17T16:51:03.393300Z

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