0.4.1 • Published 5 years ago
react-yah v0.4.1
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