Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 760 Bytes

transform-react-constant-elements.md

File metadata and controls

13 lines (10 loc) · 760 Bytes
layout title description permalink package
docs
React constant elements transformer
Treat React JSX elements as value types and hoist them to the highest scope.
/docs/plugins/transform-react-constant-elements/
babel-plugin-transform-react-constant-elements

Hoists element creation to the top level for subtrees that are fully static, which reduces call to React.createElement and the resulting allocations. More importantly, it tells React that the subtree hasn't changed so React can completely skip it when reconciling.

This transform should be enabled only in production (e.g., just before minifying your code) because although it improves runtime performance, it makes warning messages more cryptic.

{% include package_readme.html %}