Feature Request
Ionic version: 5.5.1
Usage: React
Describe the Feature Request
Could you update the dependencies of Ionic React? A lot of bugs happen when I try to integrate with my app.
Describe Preferred Solution
I don't know where the problem is coming from. But when I create a regular react app, those libraries work. I really think the problem is coming from dependencies but I'm not really sure.
Related Code
For those who want to test, the package is use_referred_state
The code to integrate it:
import React from "react"
const App: React.FC = () => {
const [i, iRef, setI] = useReferredState<number>(0)
useRef(() => {
setI(iRef.current + 1)
})
return (
<span>
React updated State: {i} times
</span>
)
}
The Error

npx create-react-app COMMANDThanks for the issue. The problem here is that your application likely has React 16 installed; however, use_referred_state requires React 17. This resulted in both React 16 and React 17 being installed (See Error 3 in the screenshot).
This is not really an Ionic Framework bug, but more of a dependency mismatch in your application. This does not happen in a CRA app since the latest CRA apps likely ship with React 17. That being said, I have relaxed the peer dependency requirement for Ionic React in https://github.com/ionic-team/ionic-framework/pull/22645 to accommodate some changes to npm 7. This relaxed requirement should be available in an upcoming release of Ionic Framework.
For now, I recommend installing React 17 manually:
npm install react@^17.0.1 react-dom@^17.0.1 --legacy-peer-deps
Thanks it works !
Most helpful comment
Thanks for the issue. The problem here is that your application likely has React 16 installed; however,
use_referred_staterequires React 17. This resulted in both React 16 and React 17 being installed (See Error 3 in the screenshot).This is not really an Ionic Framework bug, but more of a dependency mismatch in your application. This does not happen in a CRA app since the latest CRA apps likely ship with React 17. That being said, I have relaxed the peer dependency requirement for Ionic React in https://github.com/ionic-team/ionic-framework/pull/22645 to accommodate some changes to npm 7. This relaxed requirement should be available in an upcoming release of Ionic Framework.
For now, I recommend installing React 17 manually: