Closed Ofer-Gal closed 1 year ago
Hi @Ofer-Gal! I'm really sorry for the long long reply. I tried to reproduce the issue without success. I used npm create vite
(React+TS). Not sure, if the issue is gone because of minor updates I recently applied.
import { useState } from "react";
import NewWindow from "react-new-window";
const Demo = () => (
<NewWindow>
<h1>Hi 👋</h1>
</NewWindow>
);
function App() {
const [open, setOpen] = useState(false);
return (
<div className="App">
<button onClick={() => setOpen(true)}>Open</button>
{open && <Demo />}
</div>
);
}
export default App;
If possible to reproduce again, I will be more than happy to help.
I created component just like the example: `const Demo = () => (
Hi 👋
)` I get TypeScript Error: (alias) class NewWindow import NewWindow 'NewWindow' cannot be used as a JSX component. Its instance type 'NewWindow' is not a valid JSX element. Type 'NewWindow' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.ts(2786)
I have to use TypeScript in SPFx What am I doing wrong? Thanks