Skip to content

Minimal example throws: Uncaught TypeError: Cannot convert undefined or null to object #34

@elizavetaRa

Description

@elizavetaRa

Tested with latest package version as well as earlier version 1.0.0

Following the instructions and creating the minimal example from your readme thows uncaught runtime error.

import React from 'react';
import { MathJaxProvider, MathJaxHtml } from 'mathjax3-react';

function App() {
  return (
    <div>
      <MathJaxProvider>
        <MathJaxHtml html={html} />
      </MathJaxProvider>
    </div>
  );
}

input html:

const html = `
<p>Let's analise this equation:</p>
<p style="text-align:center;">
  <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
    <msup>
      <mrow>
        <mi>r</mi>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </msup>
    <mo>+</mo>
    <msup>
      <mrow>
        <mi>z</mi>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </msup>
    <mo>=</mo>
    <mn>4</mn>
  </math>
</p>
`;

The console output:
Uncaught TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at s (tex-mml-chtml.js:1:32675) at s (tex-mml-chtml.js:1:32793) at s (tex-mml-chtml.js:1:32793) at e.combineWithMathJax (tex-mml-chtml.js:1:33406) at Object.<anonymous> (tex-mml-chtml.js:1:712679) at Object.<anonymous> (tex-mml-chtml.js:1:712791) at i (tex-mml-chtml.js:1:110) at Object.<anonymous> (tex-mml-chtml.js:1:258993) at i (tex-mml-chtml.js:1:110)Uncaught TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at s (tex-mml-chtml.js:1:32675) at s (tex-mml-chtml.js:1:32793) at s (tex-mml-chtml.js:1:32793) at e.combineWithMathJax (tex-mml-chtml.js:1:33406) at Object.<anonymous> (tex-mml-chtml.js:1:712679) at Object.<anonymous> (tex-mml-chtml.js:1:712791) at i (tex-mml-chtml.js:1:110) at Object.<anonymous> (tex-mml-chtml.js:1:258993) at i (tex-mml-chtml.js:1:110)

React version: "react": "^18.3.1",
"react-dom": "^18.3.1",

Node version: node -v
v22.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions