Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getChildComponent = ({ type }) => {
- let childComponent = null
- switch (type) {
- case 'component_1':
- childComponent = <SomeComponent />
- break;
- }
- return { childComponent }
- }
- export default getChildComponent
- export default class ParentComponent extends React.Component {
- render() {
- const { component } = getChildComponent({ type })
- return (
- <Container>
- <Content>
- {childComponent} // How to pass props here?
- </Content>
- </Container>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement