Types

JsxChild

JSX コンテンツ内の個々の要素を表すユニオン型

概要

JsxChild は、JSX コンテンツ内の個々の要素を表します。

type JsxChild = string | JsxElement | Variable;

ユニオンのメンバー

Type説明
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: ['ここをクリック']
};

関連する型

このガイドはどうでしたか?

JsxChild