Skip to content

Export domToReact in public API #84

@exogen

Description

@exogen

Right now, if I use the replace option to substitute certain DOM nodes with React elements, there's no good way to keep the children of that node (to pass as children to the React element) – because the React element will expect React element children, not the DOM node objects. So the current options are:

  • Turn the children back into HTML somehow and run them back through the parser in my replace function (wasteful).
  • Reach into html-react-parser/lib/dom-to-react module myself (undocumented, private API).

A nicer option would be to either export domToReact from the main entry point, or instead of throwing on non-string inputs, assume it is already a parsed DOM tree, so you can simply do parser(node.children).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions