要在 onload 上运行 imagesrore 函数,我必须调用<img src="image_7.jpg" className="hide" alt="image_7.jpg"/>image 但实际上没有使用此行,如果我删除此 onload 则不起作用,并且不会调用该函数。那么如何在反应中调用 imagestore() onload 呢?
class PicturesList extends React.Component {
constructor(props) {
super(props);
this.state = {
imagesarray: []
};
this.imagestore = this.imagestore.bind(this);
}
render() {
return (
<div>
<div onLoad= {() => this.imagestore()}>
<img src="image_7.jpg" className="hide" alt="image_7.jpg"/>
// To run the imagesrore function onload I have to call this image but actually there is no use of this line and if I remove this onload doesn't work and function …Run Code Online (Sandbox Code Playgroud) reactjs ×1