本文へ移動

Tane種

シードで同じ数列を再現し、項目を並べ替えたり選んだり、日替わりの問題を共有したり、保存した位置から再開したりできます。

「種」は英語の seed に当たる日本語です。 名前について(英語)

目次

リファレンス · Reactフック

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

ソースを見るGitHub で編集@johnmorrisdotca/tane 1.3.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。