Skip to content

Instantly share code, notes, and snippets.

@ameerthehacker
Last active October 18, 2019 10:46
Show Gist options
  • Save ameerthehacker/d2833e2250b8cd46e04daa693ed592bb to your computer and use it in GitHub Desktop.
Save ameerthehacker/d2833e2250b8cd46e04daa693ed592bb to your computer and use it in GitHub Desktop.
const content = (
<h1 className="primary">
QndReact is Quick and dirty react{" "}
<p>It is about building your own React in 90 lines of JavsScript</p>
</h1>
);
// The above jsx gets converted into
/**
* React.createElement(type, attributes, children)
* props: it is the type of the element ie. h1 for <h1></h1>
* attributes: it is an object containing key value pair of props passed to the element
* children: it the array of child elements inside it
*/
var content = React.createElement(
"h1",
{
className: "primary"
},
"QndReact is Quick and dirty react ",
// React.createElement is called in the similar way to all the child elements
React.createElement(
"p",
null,
"It is about building your own React in 90 lines of JavsScript"
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment