danawoodman / react-fontawesome

A React Font Awesome component.
https://www.npmjs.com/package/react-fontawesome
MIT License
667 stars 72 forks source link

Added displayName for debugging purposes #3

Closed amsardesai closed 9 years ago

amsardesai commented 9 years ago

Sometimes when I'm debugging using React Dev Tools, this component shows up as "Unknown Component". This simple change will make it say "FontAwesome" instead.

danawoodman commented 9 years ago

Merged, thanks @amsardesai!

rafael84 commented 9 years ago

There's just one drawback: now it is not possible to do this:

import fa from 'react-fontawesome'
...
<fa name="mobile" />
...

With a fixed displayName, we have to do this

import FontAwesome from 'react-fontawesome'
...
<FontAwesome name="mobile" />
...
amsardesai commented 9 years ago

@rafael84 I don't think it is possible to do specifically that since react components must start with a capital letter, unless they're the property of some object. This rule is enforced in the JSX transformer. More info: http://stackoverflow.com/questions/30373343/reactjs-component-names-must-begin-with-capital-letters

Otherwise, if you did the following:

import Fa from 'react-fontawesome'
...
<Fa name="mobile" />
...

It should work.