This file contains hidden or 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
interface TNeedNameChangeProps { | |
bgColor?: string; | |
fontStyle?: string; | |
fontWeight?: string; | |
[key: string]: any; | |
} | |
interface TCustomStyle extends TNeedNameChangeProps { | |
color?: string; | |
padding?: string; |
This file contains hidden or 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
import { useEffect, useRef, useReducer } from 'react'; | |
export const useCacheAbleFetch = (url) => { | |
const cache = useRef({}); | |
const initialState = { | |
status: 'idle', | |
error: null, | |
data: [], | |
loading: false, // helper to get loading state of the request |
This file contains hidden or 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
.m0 { | |
margin: 0; | |
} | |
.mt0 { | |
margin-top: 0; | |
} | |
.mr0 { | |
margin-right: 0; |
This file contains hidden or 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
// Example Arrays | |
const arr1 = [1,2,3] | |
const arr2 = [10,1,2] | |
const arr3 = [1, 12,13, 2] | |
const getIntersection = (arr1, arr2, ...rest) => { | |
const interSection = arr1.filter(x => arr2.includes(x)) | |
// if we got more than two arrays then we will check rest length | |
// it its more than 0 then we will call that function again. | |
if (rest.length === 0) { return interSection; } |