Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Helmet is not a valid jsx element

i have this problem in the react boilerplate template.

typsecript error
'Helmet' cannot be used as a JSX component. Its instance type 'Helmet' is not a valid JSX element. TS2786

     7 |   return (
     8 |     <>
  >  9 |       <Helmet>
       |        ^
    10 |         <title>404 Page Not Found</title>
    11 |         <meta name="description" content="Page not found" />
    12 |       </Helmet>

imported as

import { Helmet } from 'react-helmet-async';

investigating the "" shows this error

HelmetProvider' cannot be used as a JSX component. Its instance type 'HelmetProvider' is not a valid JSX element. Type 'HelmetProvider' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.ts(2

`import { HelmetProvider } from 'react-helmet-async';

why is this not working?

like image 581
Alexander Hemming Avatar asked Dec 11 '20 16:12

Alexander Hemming


1 Answers

I was able to resolve this by installing @types/react-helmet.

npm install --save @types/react-helmet

like image 138
Chris Wininger Avatar answered Sep 19 '22 11:09

Chris Wininger