This package is not compiling when added to a new CRA project using React 16.14.
Using Node LTS 18.16.0 & NPM 9.5.1 We get the following error
Attempted import error: 'useId' is not exported from 'react' (imported as 'useId').
- Started a new react app via
npx create-react-app my-app with Node v18.16.0
- deleted the
node_modules folder and package-lock.json file
- Updated package.json dependency versions and added Yext packages.
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@yext/search-ui-react": "^1.1.0",
"@yext/search-headless-react": "^2.1.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
- Updated
index.js to adapt back to React 16
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
const root = document.getElementById('root');
ReactDOM.render(
<App />,
root
);
- Ran
npm run build
- Error happens