Types
JsxChild
JSX コンテンツ内の各要素を表すユニオン型
概要
JsxChild は、JSX コンテンツ内の単一の要素を表します。
type JsxChild = string | JsxElement | Variable;ユニオンメンバー
| 型 | 説明 |
|---|---|
string | プレーンテキストのコンテンツ |
JsxElement | 構造化要素 |
Variable | 動的プレースホルダー |
例
基本的な型
import { JsxChild, Variable } from 'generaltranslation';
// String
const text: JsxChild = "ようこそ!";
// Variable
const name: JsxChild = { k: 'userName' } as Variable;
// Element
const link: JsxChild = {
t: 'a',
c: ['ここをクリック']
};関連する型
JsxChildren- JsxChild 要素の集合JsxElement- 構造化要素
このガイドはいかがですか?