Created
December 31, 2018 16:52
-
-
Save silicakes/46944c5e3db7c666e97504a8bffb3c12 to your computer and use it in GitHub Desktop.
This file contains 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 * 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 override = props => ({ text: "cat" }); | |
const hoc = Component => React.cloneElement(Component, override(Component.props)); | |
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