| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18⚡ | 19 |
User Story: As a developer, I want to understand every part of my code so that I can explain it and build on it.
Review your complete code and make sure you understand each concept.
const [value, setValue] = useState(initialValue)
<div onClick={handleClick}>Click me</div>
const style = { width: "100px", backgroundColor: "red" }
<div style={style}>Styled</div>
{condition && <Component />} // Render OR nothing
{condition ? <CompA /> : <CompB />} // Render A OR B
Math.floor(Math.random() * (max - min) + min)
Can you answer these questions?
useState instead of regular variables?
Regular variables reset on every render. State persists and triggers re-renders.
</details>
event.stopPropagation() in clickTarget?
To prevent the click from bubbling up to the parent and triggering missTarget.
</details>
It evaluates a condition and renders one component if true, another if false.
</details>
Because they're JavaScript object properties, not CSS. JavaScript uses camelCase.
</details>
randomNumber(0, 400) work?
It generates a random integer from 0 to 399 (inclusive).
</details>