Re:React on ES6+
by clessg on Wednesday July 08, 2015 @01:58PM
(#9853493)
You could probably use a tagged template literal that would return an object representation of the given string. Tagged template literals don't have to return strings; jsx`<Todos items=${someObject}>` could return an Element object, for example.
[ Parent
| on HN ]
Re:React on ES6+
by madeofpalk on Wednesday July 08, 2015 @10:02PM
(#9855802)
But the input is still a string? I think it's helpful to know that when you see JSX like this:
<MixinComponent>
<InnerComponent name='madeofpalk'/>
</MixinComponent>
JSX will convert that into regular JS which will look like element('MixinComponent', {},
element('InnerComponent', {name: 'madeofpalk'})
)
Parsing that string during runtime to produce the above data structure isn't ideal.