Last active
April 28, 2018 19:15
-
-
Save aquiseb/ce712a49e6f2fee31f4a1930a518d175 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
/* eslint-disable */ | |
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
class App extends React.Component { | |
static displayName = `App`; | |
static propTypes = { | |
// eslint-disable-next-line react/forbid-prop-types | |
children: PropTypes.node.isRequired | |
}; | |
constructor() { | |
super(); | |
this.state = {}; | |
} | |
render() { | |
const { children } = this.props; | |
const childrenWithProps = React.Children.map(children, child => | |
React.cloneElement(child, { ...this.props }) | |
); | |
return ( | |
<div> | |
{childrenWithProps} | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment