I am trying to find a way to run a component (FetchData), which is a pop up grid and an API pull, through a Button, so when I click the button the component renders. I am not sure what to do here (new to JS). I am using the Material UI drawer. Is there something that I am missing here?
class MiniDrawer extends React.Component {
state = {
open: false,
};
handleDrawerOpen = () => {
this.setState({ open: true });
};
handleDrawerClose = () => {
this.setState({ open: false });
};
render() {
const { classes, theme } = this.props;
return (
//main part of where help is needed
<main className={classes.content}>
<div className={classes.toolbar} />
<Button onClick={this.handleClick}>{'Get Devices'}</Button>
<FetchData />
</main>
</div>
);
}
}
MiniDrawer.propTypes = {
classes: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
};
export default withStyles(styles, { withTheme: true })(MiniDrawer);