anvil/striker-ui/lib/sxstring.ts
2023-09-21 03:41:15 -04:00

15 lines
340 B
TypeScript

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;