Skip to content

Instantly share code, notes, and snippets.

@aquiseb
Last active April 28, 2018 19:15
Show Gist options
  • Save aquiseb/ce712a49e6f2fee31f4a1930a518d175 to your computer and use it in GitHub Desktop.
Save aquiseb/ce712a49e6f2fee31f4a1930a518d175 to your computer and use it in GitHub Desktop.
/* 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