moved helper function outside of renderXJSLiteral