jamiebuilds/babel-react-optimize
jamiebuilds/babel-react-optimize has 1,663 GitHub stars and 28 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-08 02:58 UTC. Last push 2017-04-06.
:rocket: A Babel preset and plugins for optimizing React code.
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalBabel React Optimize
A Babel preset and plugins for optimizing React code.
Optimizations
transform-react-constant-elements
Input:
class MyComponent extends React.Component {
render() {
return (
<div className={this.props.className}>
<span>Hello World</span>
</div>
);
}
}
Output:
var _ref = <span>Hello World</span>;
class MyComponent extends React.Component {
render() {
return (
<div className={this.props.className}>
{_ref}
</div>
);
}
}
transform-react-inline-elements
Input:
class MyComponent extends React.Component {
render() {
return (
<div className={this.props.className}>
<span>Hello World</span>
</div>
);
}
}
Output:
class MyComponent extends React.Component {
render() {
return (
_jsx('div', { className: this.props.className }, void 0,
_jsx('span', {}, void 0, 'Hello World')
)
);
}
}
Note: You should use this with
babel-runtimeandbabel-transform-runtimeto avoid duplicating the helper code in every file.
transform-react-remove-prop-types
Input:
class MyComponent extends React.Component {
static propTypes = {
className: React.PropTypes.string.isRequired
};
render() {
return (
<div className={this.props.className}>
<span>Hello World</span>
</div>
);
}
}
Output:
class MyComponent extends React.Component {
render() {
return (
<div className={this.props.className}>
<span>Hello World</span>
</div>
);
}
}
transform-react-pure-class-to-function
Input:
class MyComponent extends React.Component {
static propTypes = {
className: React.PropTypes.string.isRequired
};
render() {
return (
<div className={this.props.className}>
<span>Hello World</span>
</div>
);
}
}
Output:
function MyComponent(props) {
return (
<div className={props.className}>
<span>Hello World</span>
</div>
);
}
MyComponent.propTypes = {
className: React.PropTypes.string.isRequired
};
Install
$ npm install --save-dev babel-preset-react-optimize
Usage
.babelrc
{
"presets": ["es2015", "react"],
"env": {
"production": {
"presets": ["react-optimize"]
}
}
}
Benchmarks
We haven't yet much benchmark. But this post can give you an idea of what you can win in real life. Notice that the win depends a lot on how you are using the React API.
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,754 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,329 starsreact/react
The library for web and native user interfaces.
252,409 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,631 stars