babel-plugin-transform-jsx-memo
Memorize the JSX element.
Last updated 5 years ago by zeroling .
Original npm · Tarball · package.json
$ npm install babel-plugin-transform-jsx-memo 
SYNC missed versions from official npm registry.

babel-plugin-transform-jsx-memo

Memorize the JSX element.

Example

In

import { createElement } from 'react';

export default function Foo(props) {
  const { message } = props;
  return (
    <div>
      Demo:
      <p x-memo>hello {message}</p>
    </div>
  );
}

Out

import { createJSXMemo as __create_jsx_memo__ } from "babel-plugin-transform-jsx-memo/lib/runtime";
import { createElement } from 'react';
export default function Foo(props) {
  const {
    message
  } = props;
  return <div>
      Demo:
      {__create_jsx_memo__(() => <p>hello {message}</p>, 0)}
    </div>;
}

Installation

$ npm install babel-plugin-transform-jsx-memo

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-jsx-memo"]
}

Via CLI

$ babel --plugins transform-jsx-memo script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-jsx-memo"]
});

Current Tags

  • 0.1.4-0                                ...           beta (3 years ago)
  • 0.1.4                                ...           latest (3 years ago)

6 Versions

  • 0.1.4                                ...           3 years ago
  • 0.1.4-0                                ...           3 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)

© 2010 - cnpmjs.org x YWFE | Home | YWFE