reason-use-clock-hook
v1.0.7
Published
reason-use-clock-hook
Downloads
3
Maintainers
Readme
Reason Hook for sharing clock logic
Install
#With npm
npm install reason-use-clock-hook --save
#With yarn
yarn add reason-use-clock-hook
#add to bs-dependencies
"bs-dependencies": [
"reason-use-clock-hook"
],
Usage
open ReasonUseClockHook;
[@react.component]
let make = () => {
let date = UseClock.useClock();
<div>
<h1> "Hello, world!"->React.string </h1>
<h2>
{"It is "
++ date->Js.Date.fromFloat->Js.Date.toLocaleTimeString
++ "."
|> React.string}
</h2>
</div>;
};