2022-03-16
3344
#jest#react
Juan Cruz Martinez
34905
Mar 16, 2022 â‹… 11 min read

React app testing: Jest and React Testing Library

Juan Cruz Martinez I'm an entrepreneur, developer, author, speaker, YouTuber, and doer of things.

Recent posts:

what's new in deno 2.4

Deno 2.4 is here: What’s new and what to expect

Deno 2.4 isn’t just a maintenance update; it’s a statement. Learn about the most impactful changes in Deno 2.4, including the return of a first-party bundler and new spec-aligned ways to handle assets.

Ikeh Akinyemi
Jul 24, 2025 â‹… 5 min read
Migrating Tanstack Start From Vinxi To Vite

Migrating Tanstack Start from Vinxi to Vite

Update your TanStack Start project from Vinxi to a Vite-based setup, including dependency adjustments and configuration file updates.

David Omotayo
Jul 24, 2025 â‹… 6 min read
AI roundtable AI proof skills

What are the AI-proof skills every frontend developer needs?

The AI freight train shows no signs of slowing down. Seven senior developers discuss how frontend devs can make themselves indispensable in the age of AI.

Matt MacCormack
Jul 23, 2025 â‹… 4 min read

Angular has grown up — and the best is yet to come

It’s never been a better time to be an Angular developer. Reflect on the highlights of Angular’s evolution from its early days to the recent v20 release.

Lewis Cianci
Jul 22, 2025 â‹… 10 min read
View all posts

2 Replies to "React app testing: Jest and React Testing Library"

  1. There is a missing chunk of code on the bottom of the first code block for App.js. The code does not work as it is. If you are stuck there, use the following code.

    “`
    import ‘./App.css’;
    import { useState, useEffect } from ‘react’;
    import { formatUserName } from ‘./utils’;

    function App() {
    const [users, setUsers] = useState([]);
    // load data from server

    useEffect(()=> {
    let mounted = true;
    const getUsers = async () => {
    await fetch(‘https://jsonplaceholder.typicode.com/users’)
    .then(response => response.json())
    .then((data) => {
    if (mounted) {
    setUsers(data);
    }
    })
    }
    getUsers();
    },[]);

    return (

    Users:

    {
    users.map( user => (
    { user.name } { formatUserName(user.username) }
    ))
    }

    );
    }

    export default App;
    “`

Leave a Reply