DenoDDeno
Powered by
NestarZN
Denoβ€’3y agoβ€’
2 replies
NestarZ

Why JSX is not working ?

// @deno-types="@types/react"
import React from "react";
const A = (): React.ReactElement => <div />;
const B = (): React.ReactElement => <A />;

TS2786 [ERROR]: 'A' cannot be used as a JSX component.
Its type '() => React.ReactElement' is not a valid JSX element type.
Type '() => React.ReactElement' is not assignable to type '(props: any, deprecatedLegacyContext?: any) => ReactNode'.
Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.
const B = (): React.ReactElement => <A />;
^
at file:///Users/elias/code/bureaudouble/bureau/src/routes/Home.tsx:23:38

'children' is declared here.
children: ReactNode;
~~~~
at file:///Users/Library/Caches/deno/npm/registry.npmjs.org/@types/react/18.2.57/index.d.ts:326:9
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

How to debug why an island is working locally but not working when deployed?
karfauKkarfau / help
4y ago
Why my place.x -= 5 not working?
antonyAantony / help
3y ago
jsx in js
bit-by-bitBbit-by-bit / help
3y ago