TS2786: 'Helmet' cannot be used as a JSX component

See original GitHub issue

Helmet works in JSX but not in Typescript, I am getting:

TS2786: 'Helmet' cannot be used as a JSX component
Type 'Helmet' is missing the following properties from type 'ElementClass':
render, context, setState, forceUpdate

import { Helmet } from 'react-helmet';

return (
    <>
      <Helmet>
        <title>
          {translation('supportPage.heading')}
        </title>
      </Helmet>
      <Breadcrumbs />
      ...
  </>
);

react@17.0.1
react-helmet@6.1.0
@types/react-helmet@6.1.1 (devDependencies)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:12
  • Comments:13

github_iconTop GitHub Comments

10reactions
JohnDevittcommented, Jun 1, 2022

+1 Similar issue with react 18

7reactions
0xD4V1NC1commented, May 26, 2022

also experiencing issues with this once upgrading to react-18

Read more comments on GitHub >

github_iconTop Results From Across the Web

Helmet is not a valid jsx element - reactjs
i have this problem in the react boilerplate template. typsecript error 'Helmet' cannot be used as a ...
Read more >
ts2786: 'provider' cannot be used as a jsx component.
Getting TS2786 for Helmet and HelmetProvider when setting up a new project. ERROR in internals/startingTemplate/src/app/components/NotFoundPage/index ...
Read more >
[Solved]-Helmet is not a valid jsx element-Reactjs
[Solved]-Helmet is not a valid jsx element-Reactjs. Search. score:24. Accepted answer. I was able to resolve this by installing @types/react-helmet.
Read more >
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 >
DevExtreme component cannot be used as a JSX ...
'Button' cannot be used as a JSX component. Its instance type 'Button' is not a valid JSX element. The types returned by 'render()'...
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