I have to pass react element to html attribute:
let element = (
<div>
<div> test</div>
<div> <span> test333</span></div>
</div>
)
<div data-react = {element}></div>
However I get "object Object" inside the data-react attribute, is there a way I could use a method to pass dom element and use that inside my render function?
This is the expected o/p I'm trying to get to render it as a react element:

UPDATE::::::::: So here is what I have tried:
I want to show a tooltip that has HTML content, however data-tip accepts only "string" and not html. Hence now im using react component to show the tooltip content.
Now I want to pass the tooltip content to my react component that I'll use to show the tooltip, but for that I need to find a way to pass the content defined:
let element = (
<div>
<div> test</div>
<div> <span> test333</span></div>
</div>
)
<div data-react = {element}></div>
hence I used: <div data-tip = {ReactDOMServer.renderToString(elements)}></div>
with this in my tooltip component
<Tooltip>
const tipvalue = e.target.getAttribute("data-tip") ;
I get data-tip value as a string, now I want to pass this to my react component to render the html.
<Tooltip>
<ReactTooltip content = {tipvalue}/>
</Tooltip>
export default class ReactToolTip extends PureComponent {
render() {
const doc = new DOMParser().parseFromString(this.props.content, "application/xml");
const htmlSections = doc;
return (
{htmlSections}
);
}
}
not sure how to render it in the component after this? any ideass???

"object Object". Also, what are you trying to do withdata-react?