Answers for "basic enzyme code for react component"

2

react enzyme

// global config react and enzyme

import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { shallow, mount, render } from 'enzyme'
import renderer from 'react-test-renderer'

configure({ adapter: new Adapter() })

global.shallow = shallow
global.mount = mount
global.render = render
global.renderer = renderer
Posted by: Guest on September-19-2020
0

react enzyme

step by step how to fix enzyme-adapter-react-16  not support for React version 17


step one : npm i npm-install-peers -g
step two copy this : 
"peerDependencies": {
    "react": "^16.13.1",
    "react-dom": "^16.13.1"
}
step three: typing in your terminal npm-install-peers
Posted by: Guest on November-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language