Check out example codes for "calendar.js:156 Uncaught TypeError: Cannot set property 'src' of null at HTMLDivElement.<anonymous>". It will help you in understanding the concepts better.

Code Example 1

If your img element looks like this,

<img id="idToTarget" src="">
and SRC is set to a valid resource URI, then

document.getElementById('idToTarget').src = SRC
is how that line would be written.

Learn ReactJs, React Native from akashmittal.com