jxnblk / jxnblk/macro-components
Relying on function.name is brittle
- Dominant language
- JavaScript
- Stars
- 482
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
I think relying on `fn.name` makes the API very brittle.
The function name can (and usually does!) change during minification.
I understand `.dispayName` or explicitly specifying it as a "fake `name` prop" works as a more reliable fallback but I don’t think most people will be aware unless you force this. The `name` prop is also problematic because components might accept a legitimate `name` prop, and the API clobbers it.
Apologies if I misunderstood the API!
(Note: I know it says in the README to set `displayName`. But most people won't because it works without that in DEV.)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the README's displayName guidance and review the issue discussion about fn.name, minification, and the name prop. Determine the intended API change for stable component identity without clobbering legitimate props; the issue does not name implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100