reactjsfusion

ReferenceError: Helmet is not defined in Fusion.js


I was building a Todo app referring to Fusion.js docs

I added fusion-plugin-react-helmet-async plugin using yarn but it seem to have an error.

I tried to import Helmet but that does not seem to work. Is there something that I'm missing. Could anyone please help?

Code

import React, { useState } from "react";

const Root = () => {
  const [todos, setTodos] = useState([]);
  const [inputText, setInputText] = useState("");

  ...

  return (
    <React.Fragment>
      <Helmet>
        <style>
          {`
        body {
          background-color: #f5f5f5;
          font: 24px 'Helvetica Neue', Helvetica, Arial, sans-serif;
        }
      `}
        </style>
      </Helmet>
      <h1>todos</h1>
      <div className="container">
        ...
      </div>
    </React.Fragment>
  );
};

export default <Root />;

Error Message

error-on-browser


Solution

  • import statement was missing in the docs. I opened a GitHub issue on this and someone from the Fusion.js team corrected the docs. After adding the below statement, it worked.

    import { Helmet } from "fusion-plugin-react-helmet-async";