You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.
Following up on a suggestion made by @jasongrout during the latest Phosphor session/call, I think we should add a "pass thru" vdom element that renders a real DOM element using a callback. This could act like an escape hatch from Phosphor's vdom and allow for composition with vdom elements from other libraries (like React, hint, hint).
Given the structure of the virtualdom package and the updateContent function, I think it would make sense to implement this via an hpass function with the following signature:
This could exist alongside the extant h function. During updateContent, when a node with:
node.type==='passthru'
is encountered, node.callback(host) will be invoked, and from that point on any diffing/updating will be the responsibility of the callback.
I think the most important/urgent use case for this is allowing for the blending of React vdom into Phosphor vdom. The above pattern can mesh very nicely with ReactDOM.render(host, Component), since that function does its own diffing. This would allow Phosphor to better accommodate React while still avoiding any dependency on it.
hpass/VirtualElementPass avoids the need for any explicit dependency on React in any of the Phosphor core packages. In addition, it might also be nice to make an optional @phosphor/react package that could include sugar such as:
Following up on a suggestion made by @jasongrout during the latest Phosphor session/call, I think we should add a "pass thru" vdom element that renders a real DOM element using a callback. This could act like an escape hatch from Phosphor's vdom and allow for composition with vdom elements from other libraries (like React, hint, hint).
Given the structure of the
virtualdom
package and theupdateContent
function, I think it would make sense to implement this via anhpass
function with the following signature:This could exist alongside the extant
h
function. DuringupdateContent
, when a node with:is encountered,
node.callback(host)
will be invoked, and from that point on any diffing/updating will be the responsibility of the callback.I think the most important/urgent use case for this is allowing for the blending of React vdom into Phosphor vdom. The above pattern can mesh very nicely with
ReactDOM.render(host, Component)
, since that function does its own diffing. This would allow Phosphor to better accommodate React while still avoiding any dependency on it.I'm currently prepping a PR based on the above.
cc @jasongrout @blink1073 @sccolbert
The text was updated successfully, but these errors were encountered: