I use the following code to fetch the C language files from RawGithub it works for other languages but in C it shows the HTML of my react app
const [code, setCode] = useState("");
useEffect(() => {
fetch(codeRawUrl, {
headers: {
'Content-Type': 'text/plain'
}
})
.then((response) => response.text())
.then((text) => setCode(text));
}, [codeRawUrl]);
<code className={`language-${language} match-braces rainbow-braces`}>
{code}
</code>
Code from C language file from Github Raw