Reputation: 5615
I have a component Layout
which I used to style the layout of my app and that's where I introduced react-helmet
The component is like this
import React from 'react';
import { Global, css } from '@emotion/core';
import Helmet from 'react-helmet';
import Header from '../components/header';
const Layout = ({ children }) => (
<>
<Global
styles={css`
// some CSS style
/>
<Helmet>
<html lang="en" />
<title>title</title>
<meta name="description" content="site description" />
</Helmet>
<Header />
<main
css={css`
// some css
`}
>
{children}
</main>
</>
);
export default Layout;
After I added <Helmet />
, I have this error poppin up. And if I removed <Helmet />
from my component, the error would be gone. apparently I didn't forgot to export my Layout
component so I really have no idea where this came from.
Upvotes: 2
Views: 2050
Reputation: 2774
You need to use named import with react-helmet
.
import {Helmet} from "react-helmet";
Docs: https://github.com/nfl/react-helmet#example
Upvotes: 6