Skip to content

C4 State and freshness

12 minSuggested first: L23 Parsing and code generation

Outcome

Use the stated rules to explain a reducer step, an effect rerun, and a cache miss.

The case

A toy app stores a count, displays it only while a switch is on, and caches a separate report with a TTL of 30 seconds. A reducer increments the count on add. The view tracks only the properties it read in its latest completed run. The report cache is well below its capacity.

Each item has one accepted answer and can be retried; after a miss, the review link names the lesson to revisit.

Checkpoint items

1. Transition

Counts toward completion

The count starts at 2. Dispatch add with an amount of 3, then an unknown action. What is the count?

Choose one answer

2. Dependency

Counts toward completion

The view has rerun with the switch off. What does a change to the count alone do?

Choose one answer

3. Cache

Counts toward completion

After 31 seconds the cached report isn't reused. Why?

Choose one answer

Review

Review beyond the score. Explain which rule answers each question. If your explanation assumes a behavior the case doesn't state, rewrite it using the stated evidence. Then move on to the capstone, after reviewing any misses.