Headless UI transitions and dialog not working on react 18
See original GitHub issueHello 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.
-
yarn add @headlessui/react@next
-
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>
- Test the toggle => it works
- update to react 18 beta => yarn add react-dom@next; yarn add react@next
- Now toggle does not work
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:10
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try to disable strict mode, I had the same issue too. But I resolved it by disabling the react strict mode
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