-
Notifications
You must be signed in to change notification settings - Fork 0
/
people.js
42 lines (35 loc) · 861 Bytes
/
people.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react'
import ReactDOM from 'react-dom'
import singleSpaReact from 'single-spa-react'
import { property } from 'lodash'
import setPublicPath from './set-public-path.js'
const reactLifecycles = singleSpaReact({
React,
ReactDOM,
loadRootComponent: () => import(/* webpackChunkName: "people-app" */'./root.component.js').then(property('default')),
domElementGetter,
})
export const bootstrap = [
() => {
return setPublicPath()
},
reactLifecycles.bootstrap,
]
export const mount = [
reactLifecycles.mount,
]
export const unmount = [
reactLifecycles.unmount,
]
export const unload = [
reactLifecycles.unload,
]
function domElementGetter() {
let el = document.getElementById("people");
if (!el) {
el = document.createElement('div');
el.id = 'people';
document.body.appendChild(el);
}
return el;
}