displayName is set to "o" when minifiying Stateless function components via webpack
See original GitHub issueGiven a component defined as:
export const SubmitButton = ({readyState, defaultText, pendingText}) => (
<button
className="btn btn-lg btn-primary btn-block"
type="submit"
disabled={readyState === "pending"}>
{
readyState === "pending"
? (pendingText || defaultText)
: defaultText
}
</button>
);
and minified with webpack’s UglifyJsPlugin, you get components with displayName “o” in the React browser tools.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:14 (2 by maintainers)
Top Results From Across the Web
how to set displayName in a functional component [React]
The docs for displayName say. The displayName string is used in debugging messages. Usually, you don't need to set it explicitly because it's...
Read more >React displayName on production is minified, how to turn off?
I'm fixing this by manually setting the displayName on each component. Once I've done it for all of them, it will be easier,...
Read more >React Basics - GitHub Pages
Webpack is a modular build tool that has two sets of functionality ... Although the Stateless component has no state, it still receives...
Read more >babel-plugin-transform-react-stateless-component-name - npm
A babel plugin to add name for default exported stateless components.. Latest version: 1.1.2, last published: 5 years ago. Start using ...
Read more >Learning React - Repository Institut Informatika dan Bisnis Darmajaya
Refs in Stateless Functional Components. 134. React State Management. 135. Introducing Component State. 136. Initializing State from Properties.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Mind blown 😮 Thanks a bunch!
For others who stumble onto this discussion:
@silvenon I wouldn’t recommend it. Why not compare the type to the object exactly?