JSFiddle - React, Tailwind, and code Playground

HTML

<span id="temp">178</span><a id="toggle" href="javascript:void(0)">℃</a>

JavaScript

window.ce;
        window.fa;
$(document).ready(function () {
    
   ce = parseInt($("#temp").text(), 10);
         fa = Math.round(ce * 1.8 + 32);
        $("a").on("click", function () {
            if ($(this).text() == "℃") {
                $(this).html("℉");
                $("#temp").text(window.fa);
            } else {
                $(this).html("℃");
                $("#temp").text(window.ce);
            }
        });
    });