Created
December 17, 2019 10:15
-
-
Save paschalidi/7219a2e8e61465247d7b6a35b0e5f6e6 to your computer and use it in GitHub Desktop.
What is equivalent of the following using React.createElement?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const element = ( | |
<h1 className="greeting"> | |
Hello, world! | |
</h1> | |
); | |
// answer | |
const element = React.createElement( | |
'h1', | |
{className: 'greeting'}, | |
'Hello, world!' | |
); |
explain this line of code to me
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To create elements in React using React.createElement, you can specify the element type, its properties (or props), and its children (if any) as arguments.