In this article, we will review the below code snippet picked from react-scan source code. const cache = new WeakMap<object, string>(); export function fastSerialize(value: unknown, depth = 0): string { ... if (value === null) return 'null'; ...
In this article, we review a code snippet from react-scan source code. export const ignoredProps = new WeakSet< Exclude<ReactNode, undefined | null | string | number | boolean | bigint> >(); export const ignoreScan = (node: ReactNode) => { if (n...
In this article, we review the below code snippet picked from event-tracking.ts export const startTimingTracking = () => { const unSubPerformance = setupPerformancePublisher(); const unSubDirtyTaskTracking = startDirtyTaskTracking(); const unSu...
In this article, we will review the below code snippet from react-scan source code. export const createHighlightCanvas = (root: HTMLElement) => { highlightCanvas = document.createElement('canvas'); highlightCtx = highlightCanvas.getContext('2d', ...
In this article, we will review the below code snippet from react-scan source code. const initRootContainer = (): RootContainer => { if (rootContainer && shadowRoot) { return { rootContainer, shadowRoot }; } rootContainer = document.create...
I found the below code snippet in packages/scan/core/index.ts in react-scan source code. const fragment = document.createDocumentFragment(); In this article, you will learn What is DocumentFragment? How is DocumentFragment used in react-scan? cre...
In this article, we analyze how Preact is used in react-scan source code. What is Preact? Preact is a fast 3kB alternative to React with the same modern API. There is a Preact tutorial available. Preact’s Goals Preact aims to deliver on a few key goa...
In this article, we analyze how the options you pass into scan function are validated. Options In the example provided in react-scan repository, you will find this below code in aidenybai/react-scan/examples/sierpinski/src/index.jsx. ... import { sc...
I found DOMParser in react-scan source code as shown below. const iconSprite = new DOMParser().parseFromString( ICONS, 'image/svg+xml', ).documentElement; This picked from line 54 in packages/scan/src/core/index.ts. In this article, we und...
I found an import from “bippy” in react-scan source code. I wanted to find out what this is about. In this article, you will understand the below concepts What is react-scan? What is Bippy? How did I find this package? What is react-scan? react-...