Types

JsxChild

表示 JSX 内容中单个元素的联合类型

概述

JsxChild 表示 JSX 内容中的单个子元素。

type JsxChild = string | JsxElement | Variable;

联合成员

类型描述
string纯文本内容
JsxElement结构化元素
Variable动态占位符

示例

基本类型

import { JsxChild, Variable } from 'generaltranslation';

// 字符串
const text: JsxChild = "欢迎!";

// 变量
const name: JsxChild = { k: 'userName' } as Variable;

// 元素
const link: JsxChild = {
  t: 'a',
  c: ['点击这里']
};

相关类型

这份指南怎么样?

JsxChild