casesandberg / casesandberg/react-bounds

Component name is not preserved when wrapping

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
300
Forks
18
PR merge metrics
No merged PRs in 30d

Description

When wrapping a component, the name of the component is not carried through to the wrapped component. This means that when snapshot testing or viewing stack traces, a wrapped component will always have the name of `Component` rather than the original (and less generic) name, which can hamper debugging.

To fix, the name of the component can be assigned to the `displayName` property of the [returned Wrap component](https://github.com/casesandberg/react-bounds/blob/master/src/Wrap.js#L130). Something similar is done in the [isomorphic-style-loader](https://github.com/kriasoft/isomorphic-style-loader/blob/0c497661d239e5077e82f8f2b84884c0e55afd40/src/withStyles.js#L36)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.