rlayers icon indicating copy to clipboard operation
rlayers copied to clipboard

Using a dynamic `RStyle` in React 18 triggers a warning in the console

Open mmomtchev opened this issue 3 years ago • 8 comments

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 avatar Apr 02 '22 19:04 mmomtchev

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.

mmomtchev avatar Apr 02 '22 19:04 mmomtchev

Any updates on this issue?

BaltimoreBirds avatar Dec 20 '22 04:12 BaltimoreBirds

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

mmomtchev avatar Dec 20 '22 19:12 mmomtchev

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!

BaltimoreBirds avatar Dec 20 '22 22:12 BaltimoreBirds

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

brown-m avatar Feb 08 '23 07:02 brown-m

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.

mmomtchev avatar Feb 08 '23 15:02 mmomtchev

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

neon0404 avatar Apr 18 '23 17:04 neon0404

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

mmomtchev avatar Apr 20 '23 16:04 mmomtchev