Unofficial adapter for React 17 for Enzyme.
npm install --save-dev @hteker/enzyme-adapter-react-17
or, if you're using Yarn:
yarn add --dev @hteker/enzyme-adapter-react-17
enzyme's dependencies have not yet been updated to declare React 17 in peerDependencies. You need to add --legacy-peer-deps
to the install command for it to work correctly.
Finally, you need to configure enzyme to use the adapter you want it to use. To do this, you can use the top level configure(...)
API.
import Enzyme from 'enzyme';
import Adapter from '@hteker/enzyme-adapter-react-17';
Enzyme.configure({ adapter: new Adapter() });