question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

propTypes from stateless functional components not being removed

See original GitHub issue

I’m aware that issues have been raised for this previously and work done to fix it.

However I’m seeing issues with a library (ReactPopper) that uses this plugin. The library currently uses this plugin but with { mode: 'wrap' } which results in minified builds that reference process.env - which is not something we want, react-popper GH Issue here. I’ve forked the library and made the config change to babel-plugin-transform-react-remove-prop-types here but I’m seeing that propTypes still exist on the stateless functional components:

Steps to reproduce

  1. git clone https://github.com/nijk/react-popper.git
  2. git checkout v0.x
  3. cd react-popper
  4. npm install
  5. grep propType dist/react-popper.min.js
  6. Observe that propTypes exists in the grep output, namely on the Target & Arrow components - both of which are stateless functional components.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TrySoundcommented, Oct 19, 2018

Typescript output is also not processed. It contains propTypes inside of class iife but this plugins handles only top level propTypes assignments.

0reactions
kylemhcommented, Jul 18, 2019

Anything I can do to help push this along? I can’t tell if this is a fix or not…

Read more comments on GitHub >

github_iconTop Results From Across the Web

React stateless function component missing props but no ...
I have the following stateless functional component: function numberOfReadsControls(props) { return ( <div> <ControlLabel>Start ...
Read more >
Review Using Props with Stateless Functional Components
We've been passing props to stateless functional components. These components act like pure functions. They accept props as input and return ...
Read more >
Components and Props - React
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. This page provides an introduction to...
Read more >
Reactjs code snippets - Visual Studio Marketplace
In the following example you can see the usage of a React stateless component with prop types snippets inside a js and not...
Read more >
Components | Flow
Learn how to type React class components and stateless functional components ... We removed our dependency on prop-types and added a Flow object...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found