They are shown when you run the tests. Until then they appear as a hidden requirement.
Build a list of users that is requested from the server and handles the loading and error states. You practice useEffect with requests and asynchronous state.
Loading..., Could not load the users and No users, and the roles: the tests use them./api/users with fetch.Loading... is shown in an element with role="status".{ id, name } objects), each name is shown in an li.Could not load the users is shown in an element with role="alert".Loading... while the request is in progress.Ada Lovelace and Alan Turing → you see those two names.Could not load the users.Request the data inside a useEffect with an empty dependency array.
A single piece of state with the kind of situation and the data avoids impossible combinations.
In the preview, /api/users answers after half a second. To see the error state, request /api/users?status=500 for a moment, and put the URL back before running the tests.
useEffect for side effects.fetch, promises and error handling.The console is empty
Run your code with Ctrl+S
This console starts empty every time the preview loads. The browser's DevTools console keeps the messages with Preserve log.