@ccwukong wrote:
Hi guys, I’m trying to add Ionic React to an existing React PWA app written in ES6 by following this article https://dev.to/ionic/adding-ionic-react-to-an-existing-react-project-4kib and it worked when launching a localhost server. However, I got the following error during the unit testing:
app/containers/LoginPage/tests/index.test.js
● Test suite failed to runTypeError: React__default.createContext is not a function 8 | import PropTypes from 'prop-types'; 9 | import cx from 'classnames'; > 10 | import { IonPage } from '@ionic/react'; | ^ 11 | import Head from 'components/Head'; 12 | import NavBar from 'components/NavBar'; at Object.<anonymous> (node_modules/@ionic/react/src/contexts/IonLifeCycleContext.tsx:14:55) at Object.<anonymous> (app/components/MainLayout/index.js:10:1) at Object.<anonymous> (app/containers/LoginPage/index.js:14:1) at Object.<anonymous> (app/containers/LoginPage/tests/index.test.js:7:1)
My React packages
“react”: “^16.8.6”,
“react-dom”: “^16.8.6”,I’m not a TypeScript expert but it seems like an issue of .tsx file transpiling by babel.
Please advice, thank you.
Posts: 1
Participants: 1