-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React 18 and strict mode are not compatible with RMWC 8 and 14 #815
Comments
We're also getting this error using RMWC with ReactStrictMode enabled and react 18. |
I was trying to figure out why my snackbar wasn't showing (could see html being updated but css rules made the snackbar invisible) removing StrictMode makes it work as expected. I haven't noticed any other issues apart from this, if I noticed anything extra I can post here |
This is the same for the dialog components. I also see an error message regarding using refs with certain components (I think this is a documented problem with how the ripple effect works). This shows up either when using strict mode or not |
@kale1d0code @eleith We are currently looking into making a prerelease from our next branch, which supports React 18. I would love to know if this issue persist after the prerelease! |
I had a go with the Button and DIalog components from 14.0.2-alpha.7 and got the following error:
I do have other components installed from RMWC (v8) which could have caused this issue as some sort of mismatch. I'll try switching them all out at once later, |
@kale1d0code This is stille an issue in version 14. Right now we few other issues we need to address, but we will make an effort to address this particular issue as soon as possible. We do not plane to fix this in version 8 only in version 14. PRs are as always welcome :-) |
This is a problem for me and I'm not using React in strict mode as far as I can tell (I don't have React.StrictMode around the root of my react component). I just forked a react template with typescript and was struggling to get going with RMWC, just adding a button to the homepage. I have a button but I had to install @rmwc/touch-target in order to get @rmwc/button. Is that just because it's missing it as a dependency? Forked repo/: https://github.com/coultonluke/react-typescript-webpack-rmwc-template.git |
This is just a note as to some of the issues, for later reference...
|
version
8.0.1
issue
in react 16 / 17, RMWC "works" with react strict mode, but there are known warnings about a deprecated function
in react 18, these errors can no longer be ignored. many components now behave unexpectedly with strict mode on. as one example, ripple no longer works when rendered in strict mode:
https://codesandbox.io/s/rmwc-typescript-sandbox-forked-r4ef85?file=/src/index.tsx
other components have much more impactful breakdowns such as the textfield when used with a label
context
strict mode only runs in development mode and is meant to hightlight best practices
nextjs also recommends strict mode
workaround
the issue can be worked around simply by disabling strict mode.
this would be healthy to document in this project directly if that workaround is desired / expected.
possible workaround
it is possible that something similar to this existing PR would resolve the underlying issue. i have not tested this approach.
The text was updated successfully, but these errors were encountered: