Here is an extremely simplified version of my React component:
export class SomePage extends Component {
download() {
// this needs to be downloaded as an .html file
// is this the right way to go about it:
let html = document.getElementsByClassName("second-child-div").innerHTML;
// what else should be done here?
}
render () {
return (
<>
<div className="first-child-div">Stuff here</div>
<div className="second-child-div" onClick={()=>this.download()}>
<span className="some-other-styling-here">yada yada</span>
More html elements, styling, and text here
</div>
</>
)
}
}
I want the user to be able to:
- download
second-child-divand - save it as an
.htmlfile with all of the styling intact (i.e. "some-other-styling-here", etc.)