-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Kernel360/WAS-4/feature/boilerplate
WAS-4/tanstack-query-dev-tools 설치
- Loading branch information
Showing
15 changed files
with
180 additions
and
145 deletions.
There are no files selected for viewing
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 '@testing-library/jest-dom' | ||
import { render, screen } from '@testing-library/react' | ||
import Page from '../app/page' | ||
import "@testing-library/jest-dom"; | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
describe('Page', () => { | ||
it('renders a heading', () => { | ||
render(<Page />) | ||
import Page from "../app/page"; | ||
|
||
const heading = screen.getByRole('heading', { level: 1 }) | ||
describe("Page", () => { | ||
it("renders a heading", () => { | ||
render(<Page />); | ||
|
||
expect(heading).toBeInTheDocument() | ||
}) | ||
}) | ||
const heading = screen.getByRole("heading", { level: 1 }); | ||
|
||
expect(heading).toBeInTheDocument(); | ||
}); | ||
}); |
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,5 +1,6 @@ | ||
import { QueryClient } from "@tanstack/query-core"; | ||
import { cache } from "react"; | ||
|
||
const getQueryClient = cache(() => new QueryClient()); | ||
export default getQueryClient; | ||
import { QueryClient } from "@tanstack/query-core"; | ||
|
||
const getQueryClient = cache(() => { return new QueryClient(); }); | ||
export default getQueryClient; |
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,20 +1,22 @@ | ||
'use client' | ||
import { useRef } from 'react' | ||
import { Provider } from 'react-redux' | ||
import { makeStore, AppStore } from '@stores/store' | ||
"use client"; | ||
|
||
import { useRef } from "react"; | ||
import { Provider } from "react-redux"; | ||
|
||
import { makeStore, AppStore } from "@stores/store"; | ||
|
||
function StoreProvider({ | ||
children | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
const storeRef = useRef<AppStore>() | ||
const storeRef = useRef<AppStore>(); | ||
if (!storeRef.current) { | ||
// Create the store instance the first time this renders | ||
storeRef.current = makeStore() | ||
storeRef.current = makeStore(); | ||
} | ||
|
||
return <Provider store={storeRef.current}>{children}</Provider> | ||
return <Provider store={storeRef.current}>{children}</Provider>; | ||
} | ||
|
||
export default StoreProvider | ||
export default StoreProvider; |
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,8 +1,9 @@ | ||
import { useDispatch, useSelector, useStore } from 'react-redux' | ||
import type { TypedUseSelectorHook } from 'react-redux' | ||
import type { RootState, AppDispatch, AppStore } from './store' | ||
import type { RootState, AppDispatch, AppStore } from "./store"; | ||
import type { TypedUseSelectorHook } from "react-redux"; | ||
|
||
import { useDispatch, useSelector, useStore } from "react-redux"; | ||
|
||
// Use throughout your app instead of plain `useDispatch` and `useSelector` | ||
export const useAppDispatch: () => AppDispatch = useDispatch | ||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector | ||
export const useAppStore: () => AppStore = useStore | ||
export const useAppDispatch: () => AppDispatch = useDispatch; | ||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector; | ||
export const useAppStore: () => AppStore = useStore; |
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,13 @@ | ||
import { configureStore } from '@reduxjs/toolkit' | ||
import { configureStore } from "@reduxjs/toolkit"; | ||
|
||
export const makeStore = () => { | ||
return configureStore({ | ||
reducer: {} | ||
}) | ||
} | ||
reducer: {}, | ||
}); | ||
}; | ||
|
||
// Infer the type of makeStore | ||
export type AppStore = ReturnType<typeof makeStore> | ||
export type AppStore = ReturnType<typeof makeStore>; | ||
// Infer the `RootState` and `AppDispatch` types from the store itself | ||
export type RootState = ReturnType<AppStore['getState']> | ||
export type AppDispatch = AppStore['dispatch'] | ||
export type RootState = ReturnType<AppStore["getState"]>; | ||
export type AppDispatch = AppStore["dispatch"]; |
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
Oops, something went wrong.