Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

fusionjs/fusion-plugin-react-helmet-async

Repository files navigation

fusion-plugin-react-helmet-async

Build status

Allows adding content into the document head via a component driven api.


Table of contents


Installation

yarn add fusion-plugin-react-helmet-async

Usage

This plugin is a simple wrapper on the react-helmet-async module which handles the context provider and server side code for you.

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

const app = (
  <App>
    <Helmet>
      <title>Hello World</title>
      <link rel="canonical" href="https://www.tacobell.com/" />
    </Helmet>
    <h1>Hello World</h1>
  </App>
);

Setup

This module has no dependencies or configuration. Simply register the plugin.

// src/main.js
import App from 'fusion-react';
import HelmetPlugin from 'fusion-plugin-react-helmet-async';
import Root from './components/root';
export default async function main() {
  const app = new App(<Root />);
  app.register(HelmetPlugin);
  return app;
}