How do I use this exactly?
Closed this issue ยท 6 comments
Hello,
I have trouble getting this to work (I'm new to react so probably I'm missing something obvious).
I installed the lib via npm, declared in package.json and imported in my react class, like this:
The render method this:
The code compiles, my other elements render, but I see no icon rendered on the page.
Any help would be appreciated.
Best regards,
Mihai
just add this:
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css');
is there any better solution? having the same issue
@amihaiemil @JuHwon this repo does not include the FontAwesome assets so you must include them yourself (this is mentioned in the readme). There are many options to do this including using WebPack or just directly linking to them in your page (using CDN or local files, whatever you work)
Thanks @Casy for mentioning one option for people
Any idea how to make it work with npm? I'm using the create-react-app, and was able to use Bootstrap like a charm: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-bootstrap.
React-fontawesome is super close to that, bot not sure how I can make it work with fontawesome
package in NPM.
@mhaligowski you can install it using npm install -S react-fontawesome
and then, depending on what your build process is, you will need to include Font Awesome's CSS files. You can use the CDN version or if you're using something like Webpack you can npm i -S font-awesome
and then in your CSS/SCSS file you can @import '~font-awesome/scss/font-awesome
or similar. Hope that helps!