Enzyme expects an adapter to be configured

前端 未结 15 1434
太阳男子
太阳男子 2020-12-24 04:53

I created a new React application by create-react-app and I wanted to write a unit test to a component named \"MessageBox\" that I created in the application. This is the un

15条回答
  •  醉梦人生
    2020-12-24 05:30

    Add import React from 'react'; to the top of your file.

    You are using JSX syntax , which transpiles into React.createComponent(...). In order for this to work React variable must be defined in the scope of the file.

提交回复
热议问题