My current react application has the following versions:
react 17.0.x
react-dom 17.0.x
react-redux 7.2.x
react-router-dom 5.x.x
react-scripts 4.0.x
redux 4.x.x
So my first step to upgrade to react@18
was to update react-scripts
to 5.0
, I then updated react
and react-dom
to 18.x (also the @types for each).
Now my main entry file looks like this:
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementbyId("root")
);
This then loads my <App />
which looks like:
const App = () => {
<ConfigureProvider ... >
<ConnectedRouter history={history}>
<Switch>
<Router ... />
</Switch>
</ConnectedRouter>
</ConfigureProvider>
}
...
export default connect(mapStateToProps)(App);
I know I have to change this to use createRoot
, but does createRoot
support me passing in a Provider
from react-redux
?
Can I continue this upgrade and still use react-redux
, redux
and react-router-dom
or are any of these libraries just not compatible anymore with React 18? I'm not sure how to setup the Provider
.