Let's say we have a class component MyDocument
-
class MyDocument extends React.Component {
render() {
return <Text>Hello World!</Text>
}
}
Now this will be transpiled to
_createClass(MyDocument, [
{
key: 'render',
value: function render() {
return _react2.default.createElement(_src.Text, null, 'Hello World!');
},
},
]);
Thus we can use the above data to create an instance depending upon the type of an element. For eg - If the type of an element is 'TEXT', we create an instance new Text(root, props)
and then render the component.
Well, it totally depends on you to structure the component API. But some things will remain unchanged if you create your own, appendChild
and removeChild
.
Sure! Always happy to help you 😄. My Twitter handle is @NTulswani!