Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createMountRenderer(options) {
assertDomAvailable('mount')
const domNode = options.attachTo || global.document.createElement('div')
let instance = null
return {
render(el, context, callback) {
if (instance === null) {
const ReactWrapperComponent = createMountWrapper(el, options)
const wrappedEl = React.createElement(ReactWrapperComponent, {
Component: el.type,
props: el.props,
context,
})
instance = ReactDOM.render(wrappedEl, domNode)
if (typeof callback === 'function') {
callback()
}
} else {
createMountRenderer(options) {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
return {
render(el, context, callback) {
if (instance === null) {
const ReactWrapperComponent = createMountWrapper(el, options);
const wrappedEl = React.createElement(ReactWrapperComponent, {
Component: el.type,
props: el.props,
context,
});
instance = ReactDOM.render(wrappedEl, domNode);
if (typeof callback === 'function') {
callback();
}
} else {
createMountRenderer(options) {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
const { type, props, ref } = el;
const wrapperProps = {
Component: type,
wrappingComponentProps: options.wrappingComponentProps,
props,
context,
...(ref && { refProp: ref }),
};
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
createMountRenderer(options) {
assertDomAvailable('mount');
const { attachTo, hydrateIn } = options;
const domNode = hydrateIn || attachTo || global.document.createElement('div');
let instance = null;
return {
render(el, context, callback) {
if (instance === null) {
const { type, props, ref } = el;
const wrapperProps = {
Component: type,
props,
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = hydrateIn
createMountRenderer(options) {
assertDomAvailable('mount');
const { attachTo, hydrateIn, wrappingComponentProps } = options;
const domNode = hydrateIn || attachTo || global.document.createElement('div');
let instance = null;
const adapter = this;
return {
render(el, context, callback) {
if (instance === null) {
const { type, props, ref } = el;
const wrapperProps = {
Component: type,
props,
wrappingComponentProps,
context,
...(ref && { refProp: ref }),
};
const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
createMountRenderer(options) {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
return {
render(el, context, callback) {
if (instance === null) {
const { ref, type, props } = el;
const wrapperProps = {
Component: type,
props,
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = React.render(wrappedEl, domNode);
if (typeof callback === 'function') {
createMountRenderer(options) {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
return {
render(el, context, callback) {
if (instance === null) {
const PreactWrapperComponent = createMountWrapper(el, options);
const wrappedEl = Preact.h(PreactWrapperComponent, {
Component: el.type,
props: el.props,
context,
});
instance = Preact.render(wrappedEl, domNode);
if (typeof callback === 'function') {
callback();
}
} else {
createMountRenderer(options) {
assertDomAvailable('mount');
const domNode = options.attachTo || global.document.createElement('div');
let instance = null;
return {
render(el, context, callback) {
if (instance === null) {
const { type, props, ref } = el;
const wrapperProps = {
Component: type,
props,
context,
...(ref && { ref }),
};
const ReactWrapperComponent = createMountWrapper(el, options);
const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
instance = ReactDOM.render(wrappedEl, domNode);
if (typeof callback === 'function') {