wojtekmaj / enzyme-adapter-react-17

Unofficial adapter for React 17 for Enzyme.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: React is not defined

lakshbhutani opened this issue · comments

Do we need to import React in test file, because it is not required in components with React V17 and above . As I am getting errors ReferenceError: React is not defined in my tests file

It's not true it's not required anymore. It's just @babel/preset-env that can be configured to import it for you in a special way that's working with React 17.

Read more: https://dev.to/wojtekmaj/how-to-enable-automatic-runtime-in-react-17-with-babel-preset-react-52l