Giter Club home page Giter Club logo

Comments (4)

oliviertassinari avatar oliviertassinari commented on May 10, 2024 1

Thanks. I have updated the README.

from babel-plugin-transform-react-remove-prop-types.

oliviertassinari avatar oliviertassinari commented on May 10, 2024

Excuse me if I'm completely missing the point here

I think you do miss it 😁 .
The point is to have an eslint rule enforcing the use of propTypes.
You want to do it as propTypes are defining a clear API of your isolated component.

The thing is this code is only useful in development. It doesn't worth anything in production.
And worth, it's costing you bandwidth, parsing and evaluation time.

I'm gonna refer to the readme:

The problem solved

Remove unnecessary React propTypes from the production build. You can save bandwidth by removing them.

from babel-plugin-transform-react-remove-prop-types.

helmus avatar helmus commented on May 10, 2024

@oliviertassinari

But in the example in the readme you show a compoment that does not use the foo propType ( meaning is essentially an unused prop ).
My argument is that you shouldn't have written the foo propType in the first place ( or remove it ).

Is this a bad example then ?

const Baz = () => (
  <div />
);

Baz.propTypes = {
  foo: React.PropTypes.string
};

from babel-plugin-transform-react-remove-prop-types.

oliviertassinari avatar oliviertassinari commented on May 10, 2024

@helmus Oh right, it's not a great example!

from babel-plugin-transform-react-remove-prop-types.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.