Skip to content

michael-yx-wu/pure-render-decorator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pure render decorator

An ES7 decorator to make React components "pure".

Build Status

Installation

npm install pure-render-decorator

Usage

import {Component} from 'react';
import pureRender from 'pure-render-decorator';

@pureRender
export default class Test extends Component {
  render() {
    return <div />;
  }
}

The above example is the same as using PureRenderMixin:

var React = require('react');
var PureRenderMixin = require('react-addons-pure-render-mixin');

var Test = React.createClass({
  mixins: [
    PureRenderMixin
  ],

  render: function() {
    return <div></div>;
  }
});

As decorators are simply functions, you can also use pureRender() without the decorator syntax:

import {Component} from 'react';
import pureRender from 'pure-render-decorator';

class Test extends Component {
  render() {
    return <div />;
  }
}

export default pureRender(Test);

About

An ES7 decorator to make React components "pure".

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%