Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Columns extends React.Component {
- fetchCSVData = async () => { <-- this function
- const { ownerId } = this.props;
- const CSVTrackResponse = await getCSVClientReport({ ownerId });
- fileDownload(CSVTrackResponse, 'lifetimeTracks.csv');
- };
- render() {
- const children = React.Children.map(this.props.children, child => {
- return React.cloneElement(child, {
- onDownload: () => this.fetchCSVData()
- });
- });
- return <ColumnsContainer>{children}</ColumnsContainer>;
- }
- }
- const Reports = ({ ownerId }) => (
- <Container>
- <Header>Reports</Header>
- <Columns ownerId={ownerId}> <-- this component has a inner function
- <Cell title="LIFETIME TRACKS" />
- </Columns>
- </Container>
- );
Add Comment
Please, Sign In to add comment