question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on `injectStyles`: "Failed to execute 'appendChild' on 'Node': Only one element on document allowed."

See original GitHub issue

Possibly related: https://github.com/wwayne/react-tooltip/issues/669

DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
    at ReactTooltip.injectStyles (webpack-internal:///cpGi:1195:17)
    at ReactTooltip.injectStyles (webpack-internal:///wssv:717:25)
    at ReactTooltip.componentDidMount (webpack-internal:///cpGi:1149:12)
    at ReactTooltip.componentDidMount (webpack-internal:///wssv:707:123)
    at commitLifeCycles (webpack-internal:///fxOa:20659:24)
    at commitLayoutEffects (webpack-internal:///fxOa:23422:7)
    at HTMLUnknownElement.callCallback (webpack-internal:///fxOa:3946:14)
    at Object.invokeGuardedCallbackDev (webpack-internal:///fxOa:3995:16)
    at invokeGuardedCallback (webpack-internal:///fxOa:4057:31)
    at commitRootImpl (webpack-internal:///fxOa:23147:9) "
    at AppContainer (eval at ES6ProxyComponentFactory (webpack-internal:///wssv), <anonymous>:14:7)
    at HotExportedRoot (eval at ES6ProxyComponentFactory (webpack-internal:///wssv), <anonymous>:14:7)"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
mumarm45commented, Feb 17, 2021

Getting the same error while running the test.

7reactions
jrydcommented, Feb 17, 2021

@sumthief I am getting the same error as @ayusshar and can provide a reproducible example:

Example.js

import React from 'react';
import ReactTooltip from 'react-tooltip';

const Example = () => {
  return <div>
    <p className="text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2">Example</p>
    <div className="flex flex-wrap -m-8">
        <div className="p-8" data-testid="example" data-tip="This is a test <br/> and it doesn't work">
          <p className="text-xs text-gray-700">Example paragraph</p>
        </div>
    </div>
    <ReactTooltip multiline={true}/>
  </div>
};

export default Example;

Example.test.js

import React from 'react';
import { render } from '@testing-library/react';
import Example from './Example';
import ReactTooltip from 'react-tooltip';

describe('Example', () => {
  it('can render', () => {
    render(<Example />);
  });

  it('can render standalone', () => {
    render(<ReactTooltip multiline={true} />);
  });
});

Or as one test file all together:

import React from 'react';
import { render } from '@testing-library/react';
import ReactTooltip from 'react-tooltip';

const Example = () => {
  return <div>
    <p className="text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2">Example</p>
    <div className="flex flex-wrap -m-8">
      <div className="p-8" data-testid="example" data-tip="This is a test <br/> and it doesn't work">
        <p className="text-xs text-gray-700">Example paragraph</p>
      </div>
    </div>
    <ReactTooltip multiline={true}/>
  </div>
};

describe('Example', () => {
  it('can render', () => {
    render(<Example />);
  });

  it('can render standalone', () => {
    render(<ReactTooltip multiline={true} />);
  });
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute 'appendChild' on 'Node': Only one ...
The error arises when you click on the circle: the rectangle that should appear within the two-rectangle imported drawing doesn't appear, and the...
Read more >
Failed to execute 'appendChild' on 'Node': Only one ...
This error happens with v4.2.12. ... Failed to execute 'appendChild' on 'Node': Only one element on document allowed. ... then run npm start....
Read more >
Uncaught TypeError: Failed to execute 'appendChild' on 'Node'
In developing a Javascript function, I ran into the following error when I looked at my console: Uncaught TypeError: Failed to execute 'appendChild'...
Read more >
DOMException: Failed to execute 'appendChild' on 'Node'
Recently I managed to receive form submissions using a Netlify form on my site. However, despite the submission working perfectly I get the...
Read more >
style-loader
component -with-css-modules.js import styles from "./styles.css"; const divElement = document.createElement("div"); divElement.className = styles["my-class"] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found