emptygif
Idioma: Español

Todos los lenguajes y frameworks

React component (JSX) JavaScript

Un fragmento en JavaScript para React component (JSX) que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.

React component (JSX) JavaScript

Archivo
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} />;
}

Ejecutamos este fragmento y comparamos los bytes que devolvió.

Sitio oficial: React component (JSX)

Más en JavaScript