state variable, array changes, clock, keys list
At the most fundamental level:
When data changes, how do we update the visual representation efficiently?
let count = 0;
function render() {
const container = document.getElementById('app');
container.innerHTML = ''; // Destroy everything
container.innerHTML = `
<div>
<h1>Count: ${count}</h1>
<button onclick="increment()">+</button>
</div>
`; // Recreate from scratch
}
Problems:
let count = 0;
function render() {
const countElement = document.querySelector('.count-value');
countElement.textContent = count; // Update only what changed
}
Problems: