JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="img-input">
<img src="" alt="" id="the-image">

JavaScript

$("input").on("blur change", function () {
    var image = $("#the-image"),
        $this = $(this),
        string = $this.val();

    image[0].onerror = function () {
        alert("Image could not be loaded");
    };
    image.attr("src", string);
});