react-head-tags

0.1.0 • Public • Published

react-head-tags

ReactDOMServer.renderToNodeStream() ready component to manage document.head

Installation

npm install react-head-tags --save

Usage

import React from 'react'
import { renderToNodeStream } from 'react-dom/server'
import { HeadManager, HeadTags } from 'react-head-tags'
 
let headTags
const contentStream = renderToNodeStream(
  <HeadManager
    onHeadTagsChange={tags => {
      headTags = tags
    }}
  >
    <HeadTags>
      <title>Title</title>
      <meta name="description" content="testing" />
    </HeadTags>
  </HeadManager>,
)

Note that head tags are not collected before the app is rendered, e.g. headTags is undefined until contentStream is finished in the above example.

/react-head-tags/

    Package Sidebar

    Install

    npm i react-head-tags

    Weekly Downloads

    8

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    64.4 kB

    Total Files

    28

    Last publish

    Collaborators

    • ratson