floating-ui / react-popper

🍿⚛Official React library to use Popper, the positioning library
https://popper.js.org/react-popper/
MIT License
2.5k stars 226 forks source link

usePopper has something wrong with ReactDom.flushSync #445

Open acgblogs opened 2 years ago

acgblogs commented 2 years ago

image

how can i resolve the problem

FezVrasta commented 2 years ago

May you provide more details please?

acgblogs commented 2 years ago

May you provide more details please?

i saw the open code react-popper hooks usePopper peerDependencies support react 16.8.0,

acgblogs commented 2 years ago

"peerDependencies": { "@popperjs/core": "^2.0.0", "react": "^16.8.0 || ^17 || ^18", "react-dom": "^16.8.0 || ^17 || ^18" },

acgblogs commented 2 years ago

but it didn't work on browser, my react-dom version is 16.8 same as react

acgblogs commented 2 years ago

error is ReactDOM.flushSync is not a function

acgblogs commented 2 years ago

image

atomiks commented 2 years ago

what is the value of console.log(ReactDOM)?

acgblogs commented 2 years ago

what is the value of console.log(ReactDOM)?

image

the problem is resolved. use the version 2.2.5 can run successful.it seems that the ReactDOM. flushSync hooks acting on React version 18.x。

is the latest version 2.3.0 only suitable for React 18.x ?

FezVrasta commented 2 years ago

What you logged is React, not ReactDOM. There may be some problem with your setup.