Created
September 7, 2019 16:30
-
-
Save adamdriscoll/8e54ebb28448e31d70fe7a38109c143a to your computer and use it in GitHub Desktop.
Render Component Function of Universal Dashboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderComponent: function(component, history, dynamicallyLoaded) { | |
if (component == null) return <React.Fragment/>; | |
if (Array.isArray(component)) { | |
return component.map(x => this.renderComponent(x, history)); | |
} | |
var existingComponent = this.components.find(x => x.type === component.type); | |
if (existingComponent != null) { | |
return React.createElement(existingComponent.component, { | |
...component, | |
key: component.id, | |
history | |
}); | |
} else if (component.isPlugin && !dynamicallyLoaded) { | |
return <LazyElement component={component} key={component.id} history={history}/> | |
} | |
return internalRenderComponent(component, history); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment