I have a project now where I'm building lots of custom D3 components and
realizing that I can build the views to react to lens/cursor-scoped part(s)
of app-state by running through the generic 'update pattern' in D3, and
specifying enter() and exit() life cycles.

So I can have fully reactive views that are driven by state changes where
each view component I'm building knows exactly what parts of the DOM to
update and does not do an extra work.

When it comes to keeping the state decoupled from the DOM in this case it
is not the whole DOM state of the component that I need to synchronize in
app-state but just the data to be rendered into DOM elements (as lists or
SVG path points) and the state of user interaction with the component, e.g.
user zoomed or panned the chart so I store the new zoom and pan values in
app-state. When the component is re-rendered (e.g. coming back to a the
page from another or in session transfer scenarios) I just transition to
those app-state-retained values.

IMGUI (immediate mode graphics) is great for driving 2D canvas where some
"smart canvas" calculates the diff from app state changes and where app
state captures everything that is on the canvas, so applying the diff is
applied rather than redrawing the whole canvas is a required optimization,
and is a standard technique in game development.

If I make my D3 components spit out SVG path data rather than generate SVG
and have an SVG-path-data-to-canvas convertor (not too hard, done that
before) then a Virtual Canvas that does the diffing (in raster mode) and
patches the current canvas would be great*.

So it seems like with D3 as the DOM reconciliation engine, I can build an
IMGUI model without a Virtual DOM per se.

I never understood why someone would want to mix D3 and React in any
non-shallow way, i.e. deep integration. It just means that they're having
one DOM manager (or 'differ' if you prefer) inside another.

Obviously, this is a subtle subject so there are many opinions that may not
make total sense, and I'm trying to understand why anyone would want to use
React with D3 in any way other than a very shallow integration.

Help me understand.

Thanks.

Marc

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to