Skip to content

Commit

Permalink
[MLC-13] repo: Make lib/ .gitignore rule more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkerSm1th committed Feb 27, 2024
1 parent 3b9da01 commit d7cdebd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dist/
downloads/
eggs/
.eggs/
lib/
server/lib/
lib64/
parts/
sdist/
Expand Down
18 changes: 18 additions & 0 deletions app/src/lib/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
useDispatch,
useSelector,
useStore,
} from 'react-redux';
import type {
TypedUseSelectorHook,
} from 'react-redux';
import type {
AppDispatch,
AppStore,
RootState,
} from './store';

// 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;
14 changes: 14 additions & 0 deletions app/src/lib/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
configureStore,
} from '@reduxjs/toolkit';

export const makeStore = () =>
configureStore({
reducer: {},
});

// Infer the type of 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'];
11 changes: 11 additions & 0 deletions app/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
type ClassValue,
clsx,
} from 'clsx';
import {
twMerge,
} from 'tailwind-merge';

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

0 comments on commit d7cdebd

Please sign in to comment.