-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathindex.tsx
36 lines (28 loc) · 883 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from 'react'
import ReactDOM from 'react-dom/client'
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
async function StartApp(){
try {
await worker.start({quiet:true})
} catch (error) {
console.log("error starting worker",error)
}
const rootElement = document.getElementById('root') as HTMLElement;
if(rootElement){
ReactDOM.createRoot(rootElement).render(
<React.StrictMode>
<Provider store={store}>
<ChakraProvider>
<App />
</ChakraProvider>
</Provider>
</React.StrictMode>
)
}else throw new Error("root element not found")
}
StartApp()