Let's dive into Babel:
How everything works
/haskellcamargo
GET
/whoami
<Text>
</Text>
Hi, Lorena
JSXElement
JSXOpeningElement
JSXIdentifier (name) 'Text'
(children) JSXText (value) 'Hi, Lorena'
JSXClosingElement
JSXIdentifier: (name) 'Text'
<Text>
</Text>
Hi, Lorena
React.createElement(
'Text',
null,
'Hi, Lorena'
)
function compile(tag, props, ...children) {
return React.createElement(
tag.split('').reverse().join(''),
props,
children
);
}
export default ({ t }) => ({
visitor: {
JSXIdentifier({ node }) {
node.name = node.name
.split('')
.reverse()
.join('');
}
}
});