Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iivanovw7/09b241f777b26c212e362d4bbf7e4ed3 to your computer and use it in GitHub Desktop.
Save iivanovw7/09b241f777b26c212e362d4bbf7e4ed3 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