scniro / react-codemirror2

Codemirror integrated components for React
MIT License
1.65k stars 192 forks source link

TS ERROR #216

Open iamsongqian opened 3 years ago

iamsongqian commented 3 years ago

MY CODE: import { UnControlled as CodeMirror } from "react-codemirror2"; import "codemirror/lib/codemirror.css"; import "codemirror/lib/codemirror.js"; <CodeMirror />

MY ERROR: JSX element class does not support attributes because it does not have a 'props' property ts(2607) 'CodeMirror' cannot be used as a JSX component. Its instance type 'Controlled' is not a valid JSX element. Type 'Controlled' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.

MY QUESTION: how can i fix this ts error?

Chasen-Zhang commented 2 years ago

image Have you solved the problem? --help

antman888 commented 1 year ago

I had the same issue as @Chasen-Zhang, and fixed it by updating my @types/react version in dev dependencies to the same version as my react dependency. Somehow they got out of sync.

superhos commented 10 months ago

same issue, any suggestion?