1.0.7 • Published 5 years ago

reason-use-clock-hook v1.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

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>;
};