Skip to content

Instantly share code, notes, and snippets.

@j5bot
Last active April 13, 2021 07:30
Show Gist options
  • Save j5bot/58c548136061db1876de7d7b682696a7 to your computer and use it in GitHub Desktop.
Save j5bot/58c548136061db1876de7d7b682696a7 to your computer and use it in GitHub Desktop.
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