const element = React.createElement(
'div',
{id: 'login-btn'},
'Login'
)
React.createElement()
function returns an object:{
type: 'div',
props: {
children: 'Login',
id: 'login-btn'
}
}
ReactDOM.render():
<div id='login-btn'>Login</div>
render()
method. Alternatively, in simple cases, it can be defined as a function. In either case, it takes props as an input, and returns a JSX tree as the output:const Button = ({ onLogin }) =>
<div id={'login-btn'} onClick={onLogin}>Login</div>
const Button = ({ onLogin }) => React.createElement(
'div',
{ id: 'login-btn', onClick: onLogin },
'Login'
)