by thomasfoster96 · 11y ago · 0 comments
class OuterComponent extends React.Component {
render() {
return (
<MixinComponent>
<InnerComponent />
</MixinComponent>
);
}
}
Being replaced by something more like: class OuterComponent extends React.Component {
render() {
return JSX`
<MixinComponent>
<InnerComponent />
</MixinComponent>
`;
}
} However, this would lead to further divergence. Tooling that is built around the assumptions imposed by template literals wouldn't work. It would undermine the meaning of template literals. It would be necessary to define how JSX behaves within the rest of the ECMAScript grammar within the template literal anyway.
I'm not really what the problem is here. Template strings seem to have been put in ES6 partly to do what JSX does, so it seems very odd that anyone went to the lengths of defining a language extension rather than use them.More importantly, how would you share data structures? `<Todos items=${someObject}>` would return a string with the string representation of someObject, but it wouldn't be the same object, have methods, etc.
`${`test`}`Since JSX is just JavaScript, it doesn't have any problems with nesting.