I have NextJS app with an array of URLs that I want to convert to HTML links.
First, I tried the solution described here using the following code:
    var list = document.createElement('ul'); // Create the list element
    $("body").append(list)
    $('ul').attr("id", "ticketList");
    $.each(yvars, function(i, yvars) {
        $("#ticketList").append("<li><a href='https://jeng.internal.com/browse/"+arr+"'  id="+arr+"_link>"+arr+"</a></li>");
    })
    return (
        <>
            <h1>{yname}</h1>
            <h2>{ydesc}</h2>
            <div>{list}</div>
        </>
    )
...and got this error:
Then I tried this solution:
    for (let i = 0; i < yvars.length; i++) {
        result = result + " <a href='" + yvars[i] + "'>" + "Technique " + alf[i] + "</a><br>";
    }
    document.getElementById('results').innerHTML = result
    return (
        <>
            <h1>{yname}</h1>
            <h2>{ydesc}</h2>
            <div id='results'></div>
        </>
    )
What is the preferred way of doing this?
Update:
One approach that is close to a solution is this construct:
    for (let i = 0; i < yvars.length; i++) {
        result = result + " <a href='" + yvars[i] + "'>" + "Technique " + alf[i] + "</a><br>";
    }
    return (
        <>
            <h1>{yname}</h1>
            <h2>{ydesc}</h2>
            {result}
        </>
    )
It causes the web page to look like this (I've redacted the URLs):



 
    