react-html-parser icon indicating copy to clipboard operation
react-html-parser copied to clipboard

how to handle with React.createElement ?

Open shipcake opened this issue 4 years ago • 1 comments

hi I use transform and i dont get the value from html tag like.

const options = {
  transform: (node, index) => {
    if (node.name == "button") {
      return React.createElement(
        Button,
        null,
???? <-- how to insert value to this
      )
    }
  }
}

shipcake avatar Mar 11 '20 08:03 shipcake

I'm not 100% sure what you want to do but I'm guessing you want to add all children to this tag:

            const children = processNodes(node.children, transform);
            return React.createElement(Button, null, children);

MLNW avatar Mar 23 '20 10:03 MLNW