Skip to content

Instantly share code, notes, and snippets.

@silicakes
Last active December 31, 2018 16:46
Show Gist options
  • Save silicakes/5a7490fe3deffcb3b752ba883ca0a05a to your computer and use it in GitHub Desktop.
Save silicakes/5a7490fe3deffcb3b752ba883ca0a05a to your computer and use it in GitHub Desktop.
import * as React from "react";
import { render } from "react-dom";
import "./styles.css";
function App(props) {
return (
<div className="App">
<h1> {props.text}</h1>
</div>
);
}
const hoc = Component => React.cloneElement(Component, { text: "Cat" });
const rootElement = document.getElementById("root");
render(hoc(<App text="dog" />), rootElement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment