Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Use PureComponent #64

Closed
FrancescoCioria opened this issue Sep 26, 2017 · 1 comment
Closed

Use PureComponent #64

FrancescoCioria opened this issue Sep 26, 2017 · 1 comment
Labels

Comments

@FrancescoCioria
Copy link
Contributor

requirements

extend PureComponent instead of Component as it usually increase performance and it should cause no trouble on a leaf component like TextareaAutosize

specs

{optional: describe technical specs to implement this feature, if not obvious}

misc

{optional: other useful info}

@FrancescoCioria
Copy link
Contributor Author

React suggests to not use PureComponent as the default, but to choose case by case if it's worth and safe using it. (https://facebook.github.io/react/docs/react-api.html#react.purecomponent)

For this reason I've opted to keep using React.Component.

In case you are interested in using TextareaAutosize as a PureComponent you can still do it by simply wrapping it:

// MyTextareaAutosize.js

import * as React from 'react';
import _TextareaAutosize from 'react-autosize-textarea';

export default TextareaAutosize extends React.PureComponent {
  render() {
    return <_TextareaAutosize {...this.props} />;
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant