Warnings for importing useId if React < 18
crucialfelix opened this issue · 1 comments
WARNING in ./node_modules/react-accessible-accordion/dist/es/index.js 548:16-21
export 'useId' (imported as 'useId') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version)
This attempts to import from React:
import { createElement, PureComponent, createContext, useId, useState, Fragment } from 'react';
but useId
is only in React 18.
It would be better to import React and then check if 'useId' is a defined property.
I have design system which uses React18 and react-accessible-accordion@5.0.0.
When i use my design library on a React17.x project, i am getting the ERROR as shown below...
Seems v5.0.0 is not compatible with React<18.
ERROR in ../../node_modules/react-accessible-accordion/dist/es/index.js 548:16-21
export 'useId' (imported as 'useId') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version)