swc_ecma_transforms_react

Function pure_annotations

source
pub fn pure_annotations<C>(comments: Option<C>) -> impl Pass
where C: Comments,
Expand description

A pass to add a /*#PURE#/ annotation to calls to known pure calls.

This pass adds a /*#PURE#/ annotation to calls to known pure top-level React methods, so that terser and other minifiers can safely remove them during dead code elimination. See https://reactjs.org/docs/react-api.html