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
import {forwardRef, ForwardRefRenderFunction, MutableRefObject, useRef} from 'react' | |
const _ComponentWithInternalRef: ForwardRefRenderFunction<HTMLDivElement> = (props, ref) => { | |
const internalRef: MutableRefObject<HTMLDivElement | null> = useRef(null) | |
const internalCallbackRef = (element: HTMLDivElement | null) => { | |
internalRef.current = element | |
if (!ref) return |
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
<!-- SRC: https://csswizardry.com/2020/05/the-fastest-google-fonts/ --> | |
<!-- | |
- 1. Preemptively warm up the fonts’ origin. | |
- | |
- 2. Initiate a high-priority, asynchronous fetch for the CSS file. Works in | |
- most modern browsers. | |
- | |
- 3. Initiate a low-priority, asynchronous fetch that gets applied to the page | |
- only after it’s arrived. Works in all browsers with JavaScript enabled. | |
- |
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
============================================================ | |
REACT PERFORMANCE CHECKLIST | |
============================================================ | |
1. Identify wasted renders | |
2. Extract frequently updated regions into isolated components | |
3. Use pure components when appropriate | |
4. Avoid passing new objects as props | |
5. Use the production build | |
6. Employ code splitting |