How to include a Font Awesome icon in React's render()

前端 未结 15 1640
刺人心
刺人心 2020-12-04 06:30

Whenever I try to use a Font Awesome icon in React\'s render(), it isn\'t displayed on the resulting web page although it works in normal HTML.

         


        
15条回答
  •  温柔的废话
    2020-12-04 06:49

    I was experienced this case; I need the react/redux site that should be working perfectly in production.

    but there was a 'strict mode'; Shouldn't lunch it with these commands.

    yarn global add serve
    serve -s build
    

    Should working with only click the build/index.html file. When I used fontawesome with npm font-awesome, it was working in development mode but not working in the 'strict mode'.

    Here is my solution:

    public/css/font-awesome.min.css
    public/fonts/font-awesome.eot 
    *** other different types of files(4) ***
    *** I copied these files for node_module/font-awesome ***
    *** after copied then can delete the font-awesome from package.json ***
    

    in public/index.html

    
    

    After all of above steps, the fontawesome works NICELY!!!

提交回复
热议问题