title: I have problem using preload function to load images with react-p5 library
body: <p>I have used react-p5 library to integrate the P5 library with React but when I use the preload function to load images it gives me and error. The question is, how do I get the preload p5 function to work with loading images in React?</p>
  <p>Here is the code:</p>
  <pre><code>import React, { Component } from &quot;react&quot;;
  import Sketch from &quot;react-p5&quot;;
  import ReactJS from './images/Icons/React.jpg';
  let test;
  export default class Sket extends Component {
    x = 50
    y = 50
  
    preload = (p5) =&gt;{
       test = p5.loadImage(ReactJS, ()=&gt;{
          p5.image(test, 0, 0, 50, 50)
       });
    }
  
    setup = (p5, parent) =&gt; { // window width is still not optimized for extra large screen
      var sket = p5.createCanvas(parent.offsetWidth, parent.offsetWidth).parent(parent);
      sket.position(0, 0);
    }
    draw = (p5) =&gt; {
      p5.background(0)
      p5.ellipse(this.x, this.y, 70, 70)
      this.x++
      this.y++
    //  p5.image(test, 50, 50)
    }
  
    render() {
      return &lt;Sketch setup={this.setup} draw={this.draw} /&gt;
    }
  }
  </code></pre>