jsx-dev-runtime.ts
This file
Path
src/jsx/jsx-dev-runtime.ts
21 lines 路 606 bytes 路 TypeScript
Last changed by
Merge pull request #2167 from honojs/v4Yusuke Wadabefore adoption2c44ad7
History of this fileTake it
12345678910111213141516171819202122import type { HtmlEscapedString } from '../utils/html'import { jsxFn } from './base'import type { JSXNode } from './base'export { Fragment } from './base'
export function jsxDEV( tag: string | Function, props: Record<string, unknown>, key?: string): JSXNode { let node: JSXNode if (!props || !('children' in props)) { node = jsxFn(tag, props, []) } else { const children = props.children as string | HtmlEscapedString delete props['children'] node = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]) } node.key = key return node}