class Car extends React.Component {
/* This statement creates an inheritance to React.Component & gives your class
component access to React.Component's functions*/
render(){
/* The render method is the only method you are required to define in a class
component*/
return (<h2> I'm a Car! </h2>);
/*Returning a JSX Element. The parentheses after the word "return" are necessary
to compile the JSX elements*/
}
}
*DOM refers to Document Object Model which constructs a tree of objects to represent the contents of an HTML page. The official W3C definition of DOM is:
A Platform & language-neutral interface that allows programs & scripts to dynamically access & update the content, structure & style of a document
React has 4 built-in methods that get called in the following order, when mounting a component: 1) constructor() 2) getDerivedStateFromProps() 3) render() 4) componentDidMount()
The render() method is required & will always be called. The others are optional and will be called only if you define them