Skip to content
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

Using a dynamic RStyle in React 18 triggers a warning in the console #40

Open
mmomtchev opened this issue Apr 2, 2022 · 8 comments
Open

Comments

@mmomtchev
Copy link
Owner

When using a dynamic RStyle with a render prop in React 18 in development mode, there is a warning in the console:

Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17.
@mmomtchev
Copy link
Owner Author

mmomtchev commented Apr 2, 2022

https://stackoverflow.com/questions/71720001/clean-way-for-a-component-to-support-both-react-17-and-react-18

I am still looking for a way to support both React 17 and React 18 style rendering in a proper manner.

Until then, the warning should be ignored as it has no real functional consequence - it does not apply to the rendering of the DOM, only to the off-screen rendering of the dynamic styles - your application will still use React 18 rendering.

@BaltimoreBirds
Copy link

Any updates on this issue?

@mmomtchev
Copy link
Owner Author

There is no other solution besides dropping support for React 17 and earlier, will probably happen at the next major version

@BaltimoreBirds
Copy link

There is no other solution besides dropping support for React 17 and earlier, will probably happen at the next major version

Okay, thanks for the update!

@brown-m
Copy link

brown-m commented Feb 8, 2023

Hi @mmomtchev, do you foresee this having any impact within a nextjs 13 environment with its heavy reliance on react 18 voodoo?

@mmomtchev
Copy link
Owner Author

This warning has no effect, but the one from #112 does.

Do not use dynamic inline styles if you get it - everything that can be expressed with a dynamic inline style, can also be expressed with a traditional Openlayers style function.

@neon0404
Copy link

neon0404 commented Apr 18, 2023

Any updates on this issue?
React 18 was released a year ago 👀

@mmomtchev
Copy link
Owner Author

I do not plan to drop support for React 16/17 only to remove a console.warning when using a relatively obscure feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants