I am trying to import a font for a title of a project, and I am loading the font as such:
import * as Font from 'expo-font'
const Home = () => {
return(
this.state = {
fontLoaded: false
}
async componentDidMount(){
await Font.loadAsync({
'Pacifico': require('../assets/pacifico/Pacifico.ttf'),
}).then(() => {
this.setState({fontLoaded: true})
})
<View style={{marginTop:30, alignItems:'center'}}>
{this.state.fontLoaded ? (<Text>Loading...</Text>): (
<Text style={{fontSize:40, fontFamily:'Pacifico'}}>Book Lover</Text>
)}
</View>
)}
however when I am compiling the project I get an error saying
Unexpected token, expected "=>"
and it points to the async componentDidMount(){
line
is there anything I can fix?