anvil/striker-ui/lib/sxstring.ts

15 lines
340 B
TypeScript
Raw Normal View History

import { ReactNode, createElement } from 'react';
/**
* "jsx"/"tsx" + "string"; wraps input with wrapper if input is a string.
*/
const sxstring = (
children: ReactNode,
wrapper: CreatableComponent,
): ReactNode =>
typeof children === 'string'
? createElement(wrapper, null, children)
: children;
export default sxstring;