I'm rendering a bit of html in the browser with renderToString because I need to extend some static html that's imported. Not very elegant, but has to be done.
I'm using redux with a provider and the components use useSelector
renderToString(<Provider store={store}><SomeComponent/></Provider>);
The issue is always get the warning
Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
Which I understand, but I'm not on the server. Somehow react thinks I'm on the server eventhough I'm not.
Redux fixes this usually by replacing useLayoutEffect with useEffect but only when window is not given, but since I'm in the browser it is given.
How do I avoid this warning? Can I overwrite useLayoutEffect somehow temporarily? It's imported by redux somewhere when using useSelector() so I doubt that's a feasible option, because other pieces of code should still use the normal useLayoutEffect, just not this part that's rendered with renderToString()