Skip to content

Instantly share code, notes, and snippets.

View gabrielyotoo's full-sized avatar
💖
Doing my best

Gabriel Freitas Yamamoto gabrielyotoo

💖
Doing my best
View GitHub Profile
@gabrielyotoo
gabrielyotoo / loading-button.tsx
Created October 24, 2024 20:46
MUI Loading Button
import { Button, ButtonProps, CircularProgress } from '@mui/material';
import { useMemo } from 'react';
type LoadingButtonProps = ButtonProps & {
isLoading?: boolean;
};
const LoadingButton = ({ isLoading = false, ...props }: LoadingButtonProps) => {
const loadingProps = useMemo<ButtonProps>(() => {
if (loading) {
@gabrielyotoo
gabrielyotoo / thunk-with-multiple-params.ts
Last active September 23, 2024 20:30
[Function] - Thunk function that receives other function's parameters as its own parameters
const thunkFunctionMultiParams =
<T extends unknown[], R>(fn: (...params: T) => R, ...params: T) =>
() => fn(...params);