Does Enzyme support React version 18?

Enzyme is dead. (There will be no React 18 support)

you can read the article below for more info but in short:

the API changes in React 18 meant that releasing a React 18 Enzyme adapter will not be possible


A bit of personal advice

While Migrate from Enzyme support article is available, I suggest you to just start fresh, forgetting that Enzyme has ever existed. RTL is by no means an Enzyme drop-in replacement, so having a completely fresh mindset will help you getting the most of it.


What should I do?

The answer is, as always, it depends. You don’t have to upgrade React, after all.

Here’s what I would do:

  1. Start familiarizing yourself with React Testing Library(RTL), an officially recommended library for React components.
  2. Make a rule to write new tests using RTL only.
  3. Consider making a rule to rewrite tests to RTL whenever you need to touch them and/or the component they are testing.
  4. In your designated time for repaying technical debt (you have designated time for repaying technical debt, right? …right?), rewrite your remaining Enzyme-based tests to RTL.
  5. Clean up your repo from Enzyme-specific bits
  6. When you’re ready, upgrade to React 18.

Link of complete article by Wojciech Maj, maintainer of @wojtekmaj/enzyme-adapter-react-17, React-PDF, React-Calendar, and React-Date-Picker:
https://dev.to/wojtekmaj/enzyme-is-dead-now-what-ekl

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)