javascript – Render mathjax after fetching latex math code from database (Supabase)
I am using React 18.2.0, better-react-mathjax 2.0.3 and have latex math code in supabase, and am unable to render it after fetching the data from supabase,
fetch data :
useEffect(() => {
getQuestions();
}, []);
async function getQuestions() {
try {
const { data, error } = await supabase.from("questions").select("*").limit(20)
if (error) throw error;
if (data != null) {setQuest(data);}
} catch (error) {}
}
MathJax renders the code which is static but not the code form supabase
{/* {"$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}$"} */}
{newtag}
{latex}
newtag being the fetched data and latex being the static data
Read more here: Source link
