Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-react-constant-elements

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-react-constant-elements

Treat React JSX elements as value types and hoist them to the highest scope


Version published
Weekly downloads
6M
increased by2.39%
Maintainers
4
Install size
33.9 kB
Created
Weekly downloads
 

Package description

What is @babel/plugin-transform-react-constant-elements?

The @babel/plugin-transform-react-constant-elements package is a Babel plugin that optimizes React applications by hoisting constant elements to the highest scope, which can reduce the need to recreate these elements on every render. This can result in performance improvements, especially for components that render the same static elements repeatedly.

What are @babel/plugin-transform-react-constant-elements's main functionalities?

Hoisting constant elements

This plugin will hoist the static elements <h1>Header</h1> and <p>Content</p> out of the render method, so they are only created once and reused on subsequent renders.

class MyComponent extends React.Component {
  render() {
    return (
      <div>
        <h1>Header</h1>
        <p>Content</p>
      </div>
    );
  }
}

Other packages similar to @babel/plugin-transform-react-constant-elements

Changelog

Source

v7.20.2 (2022-11-04)

:bug: Bug Fix
  • babel-core, babel-helper-create-class-features-plugin, babel-helper-module-transforms, babel-helper-plugin-utils, babel-helper-simple-access, babel-node, babel-plugin-transform-block-scoping, babel-plugin-transform-classes, babel-plugin-transform-react-constant-elements, babel-preset-env, babel-standalone, babel-types
    • #15124 fix: @babel/node repl and enable no-use-before-define rule (@liuxingbaoyu)
  • babel-plugin-transform-typescript
    • #15121 fix: tsSatisfiesExpression check with different duplicated @babel/types versions (@liuxingbaoyu)
  • babel-parser
  • babel-generator
  • babel-plugin-proposal-decorators, babel-plugin-proposal-object-rest-spread, babel-plugin-transform-jscript
    • #15113 fix: wrap anonymous class expression within statement (@JLHwung)
  • babel-plugin-transform-destructuring

Readme

Source

@babel/plugin-transform-react-constant-elements

Treat React JSX elements as value types and hoist them to the highest scope

See our website @babel/plugin-transform-react-constant-elements for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-react-constant-elements

or using yarn:

yarn add @babel/plugin-transform-react-constant-elements --dev

Keywords

FAQs

Package last updated on 04 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc