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.

Headless UI transitions and dialog not working on react 18

See original GitHub issue

Hello all! Just FYI, headlessUI transitions and dialogs don’t work with react 18 beta:

"@headlessui/react": "^1.4.2",
"next": "^12.0.2",
"next-seo": "^4.28.1",
"react": "^18.0.0-rc.0-next-ceee524a8-20211217",
"react-dom": "^18.0.0-rc.0-next-ceee524a8-20211217",

A quick way to check it.

  1. clone https://github.com/ixartz/Next-js-Boilerplate

  2. yarn add @headlessui/react@next

  3. Add this somewhere in the index

  const [isShowing, setIsShowing] = useState(false)
 ....

        <button onClick={() => setIsShowing((isShowing) => !isShowing)}>
          Toggle
        </button>

        <Transition show={isShowing}>I will appear and disappear.</Transition>
  1. Test the toggle => it works
  2. update to react 18 beta => yarn add react-dom@next; yarn add react@next
  3. Now toggle does not work

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:10

github_iconTop GitHub Comments

1reaction
byamasu-patrickcommented, Apr 18, 2022

Try to disable strict mode, I had the same issue too. But I resolved it by disabling the react strict mode

1reaction
RobinMalfaitcommented, Jan 19, 2022

Hey! Thank you for your bug report! Much appreciated! 🙏

We haven’t worked on React 18 support yet since this also introduces breaking changes. Will close this in favor of a tracking issue for React 18: https://github.com/tailwindlabs/headlessui/issues/681

Read more comments on GitHub >

github_iconTop Results From Across the Web

Headless UI "leave" transition not working in React
Most often when "leave transitions" doesn't work it's because it unmounts before the transition ends. To work ...
Read more >
Transition - Headless UI
The Transition accepts a show prop that controls whether the children should be shown or hidden, and a set of lifecycle props (like...
Read more >
How to Use the Dialog Component with Headless UI and ...
In this article, we will take a look at the Dialog (Modal) component and learn how to use it in a React project....
Read more >
React + Headless UI - Dialog (modal) - CodeSandbox
Activating extension 'vscode.typescript-language-features' failed: Could not find bundled tsserver.js.
Read more >
HeadlessUI Dialogue Part 3 -Transitions - The Javascript
To make it easier to observe, add a shorter duration for the transition that wrap the <Dialog.Overlay>. import { Fragment, useRef, useState }...
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