JSFiddle - React, Tailwind, and code Playground

HTML

<code>foo</code>
<code>bar</code>

JavaScript

$('code').each(function(){
    
    $(this).replaceWith( "<pre>" + $(this).html() + "</pre>" );
    
});