November 2019
Beginner
804 pages
20h 1m
English
In the previous section, we mentioned that JSX code is transpiled into React.createElement function calls. As its name implies, the createElement function of React creates React elements. But what are those?
To understand, let's take a look at the JavaScript code that the last JSX example transpiles into:
function FullName(props) {
render(React.createElement('span', null, props.givenName, ' ', props.lastName));
}
const element = React.createElement('div', {
id: 'root'
}, React.createElement(FullName, {
givenName: 'Sebastien',
lastName: 'Dubois'
}), React.createElement(FullName, {
givenName: 'Alexis',
lastName: 'Georges'
}));
The properties defined ...
Read now
Unlock full access