How can i insert a react component as a node

I am using prosemirror as my text editor and I need to click on a button to create a node with react and have props as an id

It will probably be tricky due to Reacts virtual DOM.

Have you looked into Portals yet? Probably still tricky to reconcile both worlds, but might be doable. Otherwise probably ReactDOM.render(element, container) but that would create individual React instances which live outside you remaining app if I’m not mistaken.

1 Like

We have a system we built to render NodeViews as React components, so it’s definitely doable. It has worked quite well for us so far.

Atlassian has a ProseMirror-based editor that is open source and they also have a similar concept. Take a look there and hopefully that should give you some good ideas: ReactNodeView class in Atlaskit editor

1 Like

Try use nodeview or view, they both have the update method, where you can use redux to dispatch an action, the payload is the component you want.