parent
e2c264a40f
commit
bbbdb42d59
1 changed files with 14 additions and 0 deletions
@ -0,0 +1,14 @@ |
||||
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; |
Loading…
Reference in new issue