useDailySeed関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Today's day and seed, which change on their own at midnight in timeZone
(UTC unless named): a page left open overnight moves to the new day's
puzzle without a reload.
On the server this reads the server's clock; a page rendered just before midnight and hydrated just after will show the new day once it hydrates.
インポート
import { useDailySeed } from "@johnmorrisdotca/tane/react";
定義
function useDailySeed(timeZone?: string): DailySeed
引数
| 名前 | 型 | 説明 |
|---|---|---|
timeZone (省略可) | string | The IANA time-zone name; UTC when omitted. |
戻り値
DailySeed
The current calendar day and its seed for the named zone.
例
import { useDailySeed } from "@johnmorrisdotca/tane/react";
import { createElement } from "react";
function DailyPuzzle() {
const today = useDailySeed("UTC");
return createElement("p", null, `${today.day}: ${today.seed}`);
}
console.log(createElement(DailyPuzzle));この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。