// ... export const Users: React.FC = () => { const [isLoading, setIsLoading] = useState(false) // this line was added const [users, setUsers] = useState([]) useEffect(() => { setIsLoading(true) // this line was added fetch('https://jsonplaceholder.typicode.com/users') .then((res) => res.json()) .then((result: User[]) => { setUsers(result) }) .catch(console.error) .finally(() => { setIsLoading(false) // this line was added }) }, []) return (

Users

{/* we conditionally render the loading or success UI */} {isLoading ? (
Loading...
) : ( )}
) }