@moox/bs-react-helmet
v3.0.0
Published
Reason / BuckleScript bindings for React Helmet, a document head manager for React
Downloads
52
Maintainers
Readme
@moox/bs-react-helmet
Reason / BuckleScript bindings for React Helmet, a document head manager for React.
Install
yarn add react-helmet @moox/bs-react-helmet
Note that you need react
, react-dom
, reason-react
and react-helmet
as peer dependencies.
Adjust your bsconfig.js
by adding this package:
"bs-dependencies": [
"reason-react",
"@moox/bs-react-helmet"
]
Usage
let component = ReasonReact.statelessComponent("CommonThings");
let make = (_) => {
...component,
render: _self =>
<BsReactHelmet defaultTitle="This is a title">
<style>
(
{j|
html {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
}
|j}
|> ReasonReact.string
)
</style>
</BsReactHelmet>
};
Server-side static rendering
let helmet = BsReactHelmet.renderStatic();
let title = helmet##title##toString();
Follow official documentation for all methods available.