In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and
returning the cached result when the same
inputs occur again.
— wikipedia
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 { Suspense, useLayoutEffect, useRef, useState } from 'react'; | |
type IFrameProps = React.ComponentPropsWithRef<'iframe'> & { | |
fallback?: JSX.Element; | |
}; | |
export function IFrame(props: IFrameProps) { | |
const { fallback, ...rest } = props; | |
return ( |
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 { | |
Dimensions, | |
LayoutChangeEvent, | |
Platform, | |
ScrollEvent, | |
ScrollView, | |
StyleSheet, | |
View, | |
} from "react-native"; | |
import {Font, Space} from "../atoms"; |
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 } from 'react'; | |
import { useHistory } from 'react-router-dom'; | |
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => { | |
const history = useHistory(); | |
const self = useRef(null); | |
const onWindowOrTabClose = event => { | |
if (!when) { |
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 React from 'react' | |
import { useT } from './hook.js' | |
const Comp = () => { | |
const { t, tDate, tTime, tDateTime, tCurrency } = useT() | |
const myDate = '1993-05-07T17:30:00z' | |
const myCurrency = 100 | |