Components are the building blocks of react
React components use JSX.
JSX is Javascript syntax. While it is optional, most React projects use it for its convenience.
Javascript Expressions can be embedded in JSX by using
{}
curly brackets
You can use traditional
if-else
statements,conditional ? operators
,for loops
, andarray.map()
functions
react knows to respond to user input using states and events.
A function that starts with
use
indicates that data is managed with a hook.
This can be done by moving state “upwards” to the closest component that contains all the things the need to use the data.
Trigger a render, render the components, commit changes to the DOM.
If a component has been rendered, you must use the
set
function to update the state in order to trigger any further rendering.
React will only recreate the DOM nodes if it sees a difference between the renders.
After the DOM has been updated by the DOM, the browser sill need to go through the process of “browser rendering” to make the changes visible.