forked from reduxjs/redux-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade react, react-18 & react-router-dom of examples workspaces
- Loading branch information
1 parent
cc7bbfd
commit 5620e36
Showing
66 changed files
with
494 additions
and
494 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
examples/action-listener/counter/src/components/ChangeThemeForm/ChangeThemeForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { render } from 'react-dom' | ||
import ReactDOM from 'react-dom/client' | ||
import { ApiProvider } from '@reduxjs/toolkit/query/react' | ||
|
||
import App from './App' | ||
import { pokemonApi } from './services/pokemon' | ||
|
||
const rootElement = document.getElementById('root') | ||
render( | ||
|
||
const reactRoot = ReactDOM.createRoot(rootElement as HTMLElement) | ||
|
||
reactRoot.render( | ||
<ApiProvider api={pokemonApi}> | ||
<App /> | ||
</ApiProvider>, | ||
rootElement | ||
</ApiProvider> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
examples/query/react/authentication-with-extrareducers/src/utils/PrivateOutlet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Navigate, Outlet, useLocation } from 'react-router-dom' | ||
import { useAuth } from '../hooks/useAuth' | ||
|
||
export function PrivateOutlet() { | ||
const auth = useAuth() | ||
const location = useLocation() | ||
|
||
return auth.user ? ( | ||
<Outlet /> | ||
) : ( | ||
<Navigate to="/login" state={{ from: location }} /> | ||
) | ||
} |
23 changes: 0 additions & 23 deletions
23
examples/query/react/authentication-with-extrareducers/src/utils/PrivateRoute.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import ReactDOM from 'react-dom/client' | ||
import { BrowserRouter } from 'react-router-dom' | ||
import { ChakraProvider } from '@chakra-ui/react' | ||
|
||
import App from './App' | ||
import { store } from './app/store' | ||
|
||
import { worker } from './mocks/browser' | ||
import { Provider } from 'react-redux' | ||
|
||
// Initialize the msw worker, wait for the service worker registration to resolve, then mount | ||
worker.start({ quiet: true }).then(() => | ||
ReactDOM.render( | ||
<React.StrictMode> | ||
<Provider store={store}> | ||
<ChakraProvider> | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter> | ||
</ChakraProvider> | ||
</Provider> | ||
</React.StrictMode>, | ||
document.getElementById('root') | ||
) | ||
) | ||
worker | ||
.start({ quiet: true }) | ||
.then(() => { | ||
const rootNode = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
) | ||
|
||
return rootNode.render( | ||
<React.StrictMode> | ||
<Provider store={store}> | ||
<ChakraProvider> | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter> | ||
</ChakraProvider> | ||
</Provider> | ||
</React.StrictMode> | ||
) | ||
}) | ||
.catch(console.error) |
13 changes: 13 additions & 0 deletions
13
examples/query/react/authentication/src/utils/PrivateOutlet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Navigate, Outlet, useLocation } from 'react-router-dom' | ||
import { useAuth } from '../hooks/useAuth' | ||
|
||
export function PrivateOutlet() { | ||
const auth = useAuth() | ||
const location = useLocation() | ||
|
||
return auth.user ? ( | ||
<Outlet /> | ||
) : ( | ||
<Navigate to="/login" state={{ from: location }} /> | ||
) | ||
} |
23 changes: 0 additions & 23 deletions
23
examples/query/react/authentication/src/utils/PrivateRoute.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import { render } from 'react-dom' | ||
import ReactDOM from 'react-dom/client' | ||
import { Provider } from 'react-redux' | ||
|
||
import App from './App' | ||
import { setupStore } from './store' | ||
|
||
const store = setupStore() | ||
|
||
const rootElement = document.getElementById('root') | ||
render( | ||
const reactRoot = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
) | ||
reactRoot.render( | ||
<Provider store={store}> | ||
<App /> | ||
</Provider>, | ||
rootElement | ||
</Provider> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { render } from 'react-dom' | ||
import ReactDOM from 'react-dom/client' | ||
import { Provider } from 'react-redux' | ||
|
||
import App from './App' | ||
import { store } from './store' | ||
|
||
const rootElement = document.getElementById('root') | ||
render( | ||
const reactRoot = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
) | ||
reactRoot.render( | ||
<Provider store={store}> | ||
<App /> | ||
</Provider>, | ||
rootElement | ||
</Provider> | ||
) |
Oops, something went wrong.