Using .displayName for easier debugging
Closed this issue ยท 3 comments
Other component libraries add say InputText.displayName = 'InputText'
for easier debugging as the name of the component will be included in the rendered result. Maybe a thought for this library?
@grabbeh good catch ๐ฏ
Currently, even when using styled-components
, we're wrapping them with a named function, which preserves the name on the component during errors:
and when debugging using the react-devtools:
However, maybe using displayName
is a more standardised practice and would avoid us an extra wrapper on the rendered component ๐
๐ป
What do you think @poteirard? I'm up for it ๐ช๐ป
Ah serves me right for not using react-devtools. I leave the decision in your capable hands (and I'll turn on react-devtools!).
React's documentation kind of implies you don't need to add it, but if you are specifically wrapping just to add a debuggable name - I'd argue displayname is a better fit.