Peter-Win / fe-gui

0 stars 0 forks source link

Problem with React18+ReactRouter+HMR #11

Closed Peter-Win closed 1 year ago

Peter-Win commented 2 years ago

ERROR in ./src/index.tsx 30:15-42 Module not found: Error: Can't resolve 'react-dom/client' in 'C:\JS\fe-gui-test\src' resolve 'react-dom/client' in 'C:\JS\fe-gui-test\src' C:\JS\fe-gui-test\node_modules\@hot-loader\react-dom\client doesn't exist

Peter-Win commented 2 years ago

@hot-loader/react-dom is used because the "hot" function (in App.[tj]sx) creates wrappers around components, but React Router gives this error in this case: Uncaught Error: [ProxyFacade] is not a component. All component children of must be a or Unfortunately, at the moment, version number 18 of @hot-loader/react-dom has not been released. We'll have to wait for the release of the desired version. Couldn't find another option. Using React Router creates a patch in the index file, which actually creates deprecated code.

Peter-Win commented 2 years ago

Command to check: npm view @hot-loader/react-dom version

Peter-Win commented 2 years ago

A patch has been released that, in development mode, uses the deprecated rendering method in conjunction with version 17 of the @hot-loader/react-dom library.

Peter-Win commented 1 year ago

Support for React 17 has been discontinued.