gatsby and react-latex-next: pb with variables


I an trying to use a react-latex-next component in a gatsby page but i get an error (TypeError: text.search is not a function) when rendering a string from a variable. Here is my page code:

import * as React  from 'react'
import 'katex/dist/katex.min.css'
import Latex from "react-latex-next"

const TestLatexPage = () => {
  const chaineLatex = `$e^x$`
  class RapidexoLatex extends React.Component {
      render() {
          return (
              <Latex> blablabla {chaineLatex}</Latex>
          )
      }
  }
  return (
      <div>
        <h3> TestLatexPage </h3>
        <RapidexoLatex/>
      </div>
  )
}

export default TestLatexPage

The data passed to the component seems to be empty or not a string. It works as expected with literals beetween the Latex tags.

Thanks for any help

Source: React – Stack Overflow

November 17, 2021
Category : News
Tags: gatsby | latex | reactjs

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.