I’m building a reactjs project, I have installed font-awesome in npm and imported font-awesome to my project, but when i run, it showed up a square icon instead of correct icon. Please help me solve this. Sorry for bad english.
My code:
import './App.css';
import React from 'react';
import 'font-awesome/css/font-awesome.min.css';
class App extends React.Component{
constructor(props){
super(props);
this.state = {
breakTime: 5,
sessionTime: 25,
};
}
render(){
return (
<div id = {"root"}>
<div className = {"title"}>Study Timer</div>
<TimeSetter onClick = {this.changeBreakTime} text={"Break Length"} time = {this.state.breakTime}/>
<TimeSetter onClick = {this.changeSessionTime} text={"Session Length"} time = {this.state.sessionTime}/>
</div>
);
}
}
function TimeSetter(props){
return (
<div>
<div>{props.text}</div>
<i className={"fas fa-arrow-up"}></i>
<span>{props.time}</span>
<i className={"fas fa-arrow-down"}></i>
</div>
);
}
export default App;
result: