Slider - cannot be used as a JSX component.
See original GitHub issueVersion
- 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:
- Created 3 years ago
- Reactions:45
- Comments:22 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
have got same issue… v9.2.4 is worked.
@OhadTutay downgrade to v9.2.4 worked for me.