Last active
April 13, 2021 07:30
-
-
Save j5bot/58c548136061db1876de7d7b682696a7 to your computer and use it in GitHub Desktop.
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
import React from 'react'; // required to use JSX | |
export const CapitalizedReferenceComponentExternals = (props) => { | |
// get references to all possible components | |
// that this component might render | |
const { type, components: Components } = props; | |
// make a Capitalized reference to a specific component | |
// which we'll render | |
let Component = Components[ type ]; | |
// render the component | |
return( | |
<div> | |
<p>I'm wrapped!</p> | |
<Component { ...props } /> | |
</div> | |
); | |
}; | |
export default CapitalizedReferenceComponentExternals; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment