emptygif
Language: English

All languages and frameworks

React component (JSX) JavaScript

A JavaScript snippet for React component (JSX) that answers requests for /pixel.gif with the empty GIF, decoded once at startup.

React component (JSX) JavaScript

File
Spacer.jsx
const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';

export function Spacer({ width = 1, height = 1, ...props }) {
  return <img src={EMPTY_GIF} width={width} height={height} alt="" aria-hidden="true" {...props} />;
}

We ran this snippet and compared the bytes it returned.

Official site: React component (JSX)

More in JavaScript