react-yah
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

Yet Another Head tag management for SSR ready React apps

Package License (MIT)

Usage

import React from 'react';
import Ssr from 'react-yah/ssr';
import Head from 'react-yah/head';
// or:
// import { Ssr, Head } from 'react-yah';
 
export default function App() {
  return (
    <Ssr>
      <html>
        <head>
          <title>Default Title</title>
          <meta name="description" content="Default Description" />
        </head>
        <body>
          <Head>
            <title>Overrided Title</title>
            <meta name="description" content="Overrided Description" />
          </Head>
        </body>
      </html>
    </Ssr>
  );
};
const ReactDOMServer = require('react-dom/server');
 
const html = ReactDOMServer.renderToStaticMarkup(React.createElement(App));
 
console.log(html);
// <html>
//   <head>
//     <title>Overrided Title</title>
//     <meta name="description" content="Overrided Description" />
//   </head>
//   <body></body>
// </html>

Development

# clone it
$ git clone https://github.com/saltyshiomix/react-yah.git
 
# install dependencies
$ cd react-yah
$ yarn
 
# test
$ yarn test
 
# build
$ yarn build

Package Sidebar

Install

npm i react-yah

Weekly Downloads

1

Version

0.4.1

License

MIT

Unpacked Size

8.32 kB

Total Files

11

Last publish

Collaborators

  • saltyshiomix