Slider - cannot be used as a JSX component.

See original GitHub issue

Version

  • rc-slider: @9.3.0
  • node: v10.16.0
  • npm: 6.9.0
  • Browser: chrome

Steps to reproduce

  • import Slider from ‘rc-slider’;
  • use it as controlled component like
<Slider value={value} onChange={handleSliderChange} />

What is actually happening?

  • it posts errors like that
error TS2607: JSX element class does not support attributes because it does not have a 'props' property.
error TS2786:'Slider' cannot be used as a JSX component.
   Its instance type '{ [x: string]: any; componentDidMount(): void; componentWillUnmount(): void; onMouseDown: (e: any) => void; onTouchStart: (e: any) => void; onFocus: (e: any) => void; onBlur: (e: any) => void; onMouseUp: () => void; ... 16 more ...; render(): Element; }' is not a valid JSX element.
   Type '{ [x: string]: any; componentDidMount(): void; componentWillUnmount(): void; onMouseDown: (e: any) => void; onTouchStart: (e: any) => void; onFocus: (e: any) => void; onBlur: (e: any) => void; onMouseUp: () => void; ... 16 more ...; render(): Element; }' is missing the following properties from type 'ElementClass': context, setState, forceUpdate, props, and 2 more.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:45
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
jicjjangcommented, Jun 3, 2020

have got same issue… v9.2.4 is worked.

7reactions
joshkopecekcommented, Jun 16, 2020

@OhadTutay downgrade to v9.2.4 worked for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Component cannot be used as a JSX component in React
The error Component cannot be used as a JSX component occurs for multiple reasons, returning an array of JSX elements instead of a...
Read more >
NPM package cannot be used as a JSX Component
I'm getting similar "TS2786: 'NumberFormat' cannot be used as a JSX component. Its instance type 'NumberFormat<unknown>' is not a valid JSX ...
Read more >
DevExtreme component cannot be used as a JSX component ...
I am trying to create a project with devextreme react components and I get the following error: TypeScript. 'Button' cannot be used as...
Read more >
Component from NPM module cannot be used as a JSX ...
I encountered this problem recently with 2 modules so far: react-tooltip and react-dates. ... 'Component'(Name here) cannot be used as a JSX component....
Read more >
'app' cannot be used as a jsx component. its return type 'void ...
Because react treats components differently. Arrays can be children of JSX nodes, but components rendered via <CamelCasedComponentName/> must return a single ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found