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.

dark-mode-toggle with React

See original GitHub issue

Hi,

A DOMException error occurs when <dark-mode-toggle> is used in React apps.

Failed to construct ‘CustomElement’: The result must not have attributes

I think it occurs when document.createElement has been called.

The error would be solved if the DOM related tasks move from constructor to connectedCallback, but I am not sure this is an appropriate change for dark-mode-toggle.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
herablogcommented, Jul 28, 2022

The site has no error. Thanks a lot for your work!

1reaction
tomayaccommented, Jul 28, 2022

Version 0.11.0 fixes this. Thanks for reporting again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-toggle-dark-mode - npm
Animated dark mode toggle as seen in blogs! ... Start using react-toggle-dark-mode in your project by running `npm i react-toggle-dark-mode` ...
Read more >
A Dark Mode Toggle with React and ThemeProvider
In this tutorial, we're going to build a toggle that allows users to switch between light and dark modes, using a <ThemeProvider wrapper...
Read more >
Toggle Dark Mode in React - DEV Community ‍ ‍
First, I set up the basic JSX, the local state, and a variable to hold the theme we get from localStorage: import React,...
Read more >
Dark Mode in React. How do you make a dark theme in react…
Step 1: Create a React app (skip if it's already done) · Step 2: Create the theme (dark/light) · Step 3: Provide and...
Read more >
react-dark-mode-toggle examples - CodeSandbox
Learn how to use react-dark-mode-toggle by viewing and forking react-dark-mode-toggle example apps on CodeSandbox.
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