react helmet npm code example

Example 1: react helmet

import React from "react";
import {Helmet} from "react-helmet";

class Application extends React.Component {
  render () {
    return (
        <div className="application">
            <Helmet>
                <meta charSet="utf-8" />
                <title>My Title</title>
                <link rel="canonical" href="http://mysite.com/example" />
            </Helmet>
            ...
        </div>
    );
  }
};

Example 2: helmet npm

// Installation
// npm install helmet --save

// Quick start
const express = require("express");
const helmet = require("helmet");

const app = express();

app.use(helmet());

// ...

Tags:

Misc Example