enzyme react setup code example
Example 1: enzyme configure adapter
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
//dont forget to install 'enzyme-adapter-react-(your React version)' dependency
//In this case 'enzyme-adapter-react-16'
configure({ adapter: new Adapter() });
Example 2: how to install enzyme
npm i --save-dev enzyme enzyme-adapter-react-16 enzyme-to-json
// Yarn
yarn add --dev enzyme enzyme-adapter-react-16 enzyme-to-json