mmomtchev / rlayers

React Component Library for OpenLayers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mmomtchev opened this issue · 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.

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.

Any updates on this issue?

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

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!

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

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.

commented

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

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