javascript - fontawesome is not working with react -


i'm trying use fontawesome react.js not working.

in button.js have:

import react "react"; import fontawesome "react-fontawesome"; const button = () => {    return <fontawesome name="rocket" />; }; export default button; 

and in index.html included fontawesome cdn: https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css

any suggestions?

there's not problem react-fontawesome package, problem in react code, write return fontawesome component outside of function, react apps not work.

look button component font-awesome, don't forget import react in button.js, , ofcourse import font-awesome css in index.html.

import react "react"; import fontawesome "react-fontawesome"; const button = () => {     return <fontawesome name="rocket" />; }; export default button; 

then need import button button.js

... import button "./button";  ... <button /> ... 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -