I have the following JSON structure and I need to convert it to an equivalent JSX element structure. The tags can be arbitrary and it can be infinitely nested.
[
{
"tag": "div",
"children": [
{
"tag": "p",
"text": "hey",
"style": {
"color": "red",
"fontSize": "12px"
}
}
]
},
{
"tag": "div",
"text": "Yo"
}
]
Should be rendered as
<div>
<p
style={{
color: 'red',
fontSize: '12px'
}}>hey</p>
</div>
<div>Yo</div>