react-yah
v0.4.1
Published
<p align="center">Yet Another Head tag management for SSR ready React apps</p> <p align="center"> <a href="https://npm.im/react-yah" alt="A version of react-yah"> <img src="https://img.shields.io/npm/v/react-yah.svg"> </a> <a href="https://npm.i
Downloads
3
Maintainers
Readme
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