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:

Catch Frontend Issues Before Users Using Chaos Engineering

Catch frontend issues before users using chaos engineering

This article covers how frontend chaos engineering helps catch UI and UX issues before users experience them using tools like gremlins.js.

Muhammed Ali
Jul 25, 2025 â‹… 5 min read
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
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