@cirosantilli/_file/react/react/hello.html by Ciro Santilli 34 Updated 2024-12-15 +Created 1970-01-01
Minimal React hello world example. As you click:By opening a web inspector, you can see that only modified elements get updated. So we understand that JSX parses its "HTML-like" into a tree, and then propagates updates on that tree.
- one counter increments every time
- the other increments every two clicks
By looking at the terminal, we see that
render()
does get called every time the button is clicked, so the tree of elements does get recreated every time. But then React diffes thing out and only updates things in the DOM where needed.