You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
340 B
15 lines
340 B
1 year ago
|
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;
|