init redux
This commit is contained in:
+10
-3
@@ -1,10 +1,12 @@
|
||||
import React, { useCallback, useState } from 'react'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import { ChakraProvider } from '@chakra-ui/react'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
import { Dashboard } from './dashboard'
|
||||
import { stars as starsContext } from './__data__/context'
|
||||
import { users } from './__data__/users'
|
||||
import { store } from './__data__/store'
|
||||
|
||||
const App = () => {
|
||||
const [stars, setStar] = useState(
|
||||
@@ -14,8 +16,11 @@ const App = () => {
|
||||
),
|
||||
)
|
||||
|
||||
const updateStar = useCallback((userId: string, rate: number) =>
|
||||
setStar((state) => ({ ...state, [userId]: rate })), [setStar])
|
||||
const updateStar = useCallback(
|
||||
(userId: string, rate: number) =>
|
||||
setStar((state) => ({ ...state, [userId]: rate })),
|
||||
[setStar],
|
||||
)
|
||||
return (
|
||||
<starsContext.Provider
|
||||
value={{
|
||||
@@ -25,7 +30,9 @@ const App = () => {
|
||||
>
|
||||
<ChakraProvider>
|
||||
<BrowserRouter>
|
||||
<Dashboard />
|
||||
<Provider store={store}>
|
||||
<Dashboard />
|
||||
</Provider>
|
||||
</BrowserRouter>
|
||||
</ChakraProvider>
|
||||
</starsContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user