Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
InitialComponent: _initialComponent
});
if (shell) {
const shellData = initialDataFromSSR ? initialDataFromSSR[SHELL_DATA] : null;
appInstance = createElement(shell.component, { data: shellData }, appInstance);
}
// Emit app launch cycle.
emit('launch');
let rootEl = isWeex ? null : document.getElementById('root');
if (isWeb && rootEl === null) throw new Error('Error: Can not find #root element, please check which exists in DOM.');
// Async render.
return render(
appInstance,
rootEl,
{ driver: UniversalDriver, hydrate }
);
})
.catch((err) => {
setChildComponent(props) {
if (this.contentWrapper) {
if ('className' in props && props.className) {
// https://github.com/ElemeFE/react-amap/issues/40
this.contentWrapper.className = props.className;
}
if ('render' in props) {
renderMarkerComponent(props.render, this.marker);
} else if ('children' in props) {
const child = props.children;
const childType = typeof child;
if (childType !== 'undefined' && this.contentWrapper) {
render(, this.contentWrapper);
}
}
}
}
it('should transfer children', function() {
class MyComponent {
render() {
expect(this.props.children).toBe('xyz');
return <div>;
}
}
render(
cloneElement(, {children: 'xyz'})
);
});
</div>
it('unmout component', () => {
let appendChildMock = jest.fn();
let removeChildMock = jest.fn();
let body = {tagName: 'BODY'};
Host.driver = {
createElement() {
return {tagName: 'DIV'};
},
appendChild: appendChildMock,
removeChild: removeChildMock,
removeAllEventListeners() {}
};
render(<div>, body);
unmountComponentAtNode(body);
let call = appendChildMock.mock.calls[0];
expect(call[0].tagName).toBe('DIV');
expect(call[1].tagName).toBe('BODY');
let call2 = removeChildMock.mock.calls[0];
expect(call2[0].tagName).toBe('DIV');
expect(call2[1].tagName).toBe('BODY');
});
});</div>
} else {
history = createHashHistory();
}
let entry = createElement(Entry, { history, routes });
if (shell) {
entry = createElement(shell.component, { data: initialData.shellData }, entry);
}
if (!launched) {
launched = true;
emit('launch');
}
render(
entry,
document.getElementById('root'),
{ driver: UniversalDriver, hydrate }
);
}
{childUpdate ? : null}
;
}
}
const styles = {
title: {
color: '#ff4400',
fontSize: 48,
fontWeight: 'bold',
}
};
Perf.start();
render(, null, {
measurer: Perf.Measurer
});
Perf.stop();
let measurements = Perf.getLastMeasurements();
Perf.printInclusive(measurements);
Perf.printExclusive(measurements);
renderPortal() {
render(this.props.element, this.props.container, {
parent: this
});
}
const Main = () => {
const [state, dispatch] = useReducer(listReducer, { data: [], selected: 0 });
return (<div>
{state.data.map(item => (
))}
<table><tbody></tbody></table>
<span aria-hidden="true">
</span></div>);
};
render(<main>, document.getElementById('main'), { driver: DriverDOM });</main>
export function render(element, container, callback) {
return originRender(element, container, {
driver: WeexDriver
}, callback);
}