The Art of Side Effects in React.js: Understanding and Using the useEffect Hook

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • jsdom

    A JavaScript implementation of various web standards, for use with Node.js

  • JSDom is a JavaScript implementation of the DOM and browser APIs that runs in Node.js. Jest uses JSDom to create a mock DOM for your tests, allowing you to test components and hooks that interact with the DOM.

  • react-hooks-testing-library

    🐏 Simple and complete React hooks testing utilities that encourage good testing practices.

  • While generally it's recommended to test the component using the hooks rather than the hooks themselves, sometimes you might find it necessary to test custom hooks directly. For such cases, there's React Hooks Testing Library. This library allows you to create a simple test harness for React hooks that handles running them within the body of a function component, as well as updating and unmounting them.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • msw

    Seamless REST/GraphQL API mocking library for browser and Node.js.

  • When testing components that make network requests inside useEffect, it can be helpful to control the responses to those requests. Mock Service Worker is a tool for mocking network requests directly in the browser. With MSW, you can create a mock server that intercepts your app's network requests and returns controlled responses.

  • jest

    Delightful JavaScript Testing.

  • Jest is a popular JavaScript testing framework developed by Facebook. It's packed with features like a zero-configuration setup for JavaScript and TypeScript, snapshot testing, async function testing, and mock functions. One of the most relevant features for testing useEffect is Jest's fake timers, which allow you to fast-forward or slow down time, a feature particularly useful for testing effects that involve delays or intervals.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts