Open
Description
Description
1.Why should the app return a component instance when matched(no mater match path or always alive).
return children && !isEmptyChildren(children)
? children
: matchAnyway
? component
? componentInstance
: render
? render(props as any)
: null
: null
In my opinion, from hide -> show, the very only method is performing SHOW_DOM.But in fact , when i use return null, it will not show or hide dom, but destroyed the dom.
if (matchOfPath) {
debugLog('--- normal match —‘)
//***//
} else {
debugLog('--- hide match ---')
// force unmount
// show ➡️ hide
if (this.liveState === LiveState.NORMAL_RENDER_MATCHED) {
this.currentSideEffect = [SideEffect.ON_HIDE_HOOK, SideEffect.SAVE_DOM_SCROLL, SideEffect.HIDE_DOM]
}
this.liveState = LiveState.HIDE_RENDER
**return null**
}
2.Why should the app instantiate with props using 'match: matchOfPath'?
What does it used for? I use 'this.props' instead of 'props', it still works.
// normal render
const props = { ...context, location, match: matchOfPath, ensureDidMount: this.getRouteDom }
const componentInstance = component && React.createElement(component, props)
Metadata
Metadata
Assignees
Labels
No labels