react-range icon indicating copy to clipboard operation
react-range copied to clipboard

'Range' cannot be used as a JSX component. Its instance type 'Range' is not a valid JSX element.

Open p-hash opened this issue 2 years ago • 6 comments

Encountered this issue today. Please let me know how can I gather more info on this

Failed to compile.
./components/Catalog/filters/queryRange.tsx:228:34
Type error: 'Range' cannot be used as a JSX component.
  Its instance type 'Range' is not a valid JSX element.
  226 |                         {!withoutRangeBar && (
  227 |                             <div className={styles.rangebarContainer}>
> 228 |                                 <Range
      |                                  ^
  229 |                                     step={step || 1}
  230 |                                     min={min}
  231 |                                     max={max}
error Command failed with exit code 1.

p-hash avatar Apr 08 '22 10:04 p-hash

I have also encountered this issue. Not able to fix though.

Aksh7706 avatar Apr 15 '22 07:04 Aksh7706

Same here. Let's go back to rc-slider 😢

aubert-creation avatar Jun 15 '22 13:06 aubert-creation

I will create a working range package against that not working packages.

atakansavas avatar Jun 15 '22 21:06 atakansavas

Add the following resolution to your package.json and reinstall your dependencies, this fixed my issue.

"resolutions": {
  "@types/react": "17.0.37"
}

Mathieu-C avatar Jul 12 '22 20:07 Mathieu-C

I'm facing this issue using React 18 + Next.JS 13. From my package.json:

"@types/react": "^18.2.6"
"@types/react-dom": "^18.2.4"
"typescript": "^5.0.4"
"next": "^13.4.1",
"react": "^18.2.0"
"react-dom": "^18.2.0"

Doing this makes the compiler ignore the error. It's not a final solution but can be used as temporary fix.

{/* @ts-ignore */}
<Range ... />

straube avatar May 13 '23 00:05 straube

Researching a little further, this might be an issue with Next.js: https://github.com/vercel/next.js/issues/42292

Locking @types/react and @types/react-dom to 18.2.3 seems to do the trick.

straube avatar May 13 '23 00:05 straube