JSFiddle - React, Tailwind, and code Playground

JavaScript

}
    let names = [];
    $.getJSON("xxx", function(data) {
        $.each(data.results, function (index, item) {
            names.push(item.name);
        });
        return names;
    });

    $("#term").autocomplete({source: names});
}