Both types can be stateful and have side effects or be purely presentational.
```jsx
// functional component
const Component = (props) => {
return (
<domElementOrComponent.../>
);
}
// class component
class Component extends React.Component {
return (
<domElementOrComponent.../>
);
}
```
*NOTE*: a component name *must* start with an uppercase letter.
Every components has two inputs: *props* and *state*. The props input is explicit while the state is implicit. State is used to determine the chages. Within the component state can be changed while the props object represent fixed values.
JSX syntax can resable HTML bat gets converted to pure JavaScript before being sent to the browser:
```js
// JSX
const element = (
<h1className="greeting">Hello, world!</h1>
);
// compiled JS shipped to browser
const element = React.createElement(
'h1', // HTML tag name
{className: 'greeting'}, // attrs as JSON
'Hello, world!' // tag content (can be nested component)
);
```
### App Entrypoint
```js
ReactDOM.render(
<RootComponent/>,
// same as
React.createElement(RootComponent, null);
document.getElementById("RootNode_parentId") // add to DOM
);
```
### Dynamic Expressions
```js
<tag>{expression}</tag> // expression is evalueted an it's result is displayed
<tagonEvent={funcReference}>{expression}</tag>
<tagonEvent={()=> func(args)}>{expression}</tag>
```
### Props
```js
<ComponentpropName={value}/> // pass a value the component
<ComponentpropName={funcreference}/> // pass a function to the component