By: Karthik Gupta in React-Native Tutorials on 2023-04-13
expo-font provides two methods for loading custom fonts in React Native:
useFonts(). Here are some key differences between the two:
loadAsync()is an asynchronous method that returns a promise. It loads the font(s) and returns an object with the loaded fonts.
useFonts() is a synchronous hook that returns an array. It loads the font(s) and returns a boolean value indicating whether the fonts are loaded or not.
loadAsync()allows you to load multiple fonts at once, whereas
useFonts()can only load one font at a time.
loadAsync()is more suitable for situations where you need to load the fonts dynamically or conditionally (e.g., based on user settings or screen size).
useFonts() is more suitable for situations where you want to load the fonts globally and use them throughout the app.
useFonts()is a React hook, so it can only be used within a functional component.
loadAsync() can be used in both functional and class components.
In summary, if you need to load fonts dynamically or conditionally, use
loadAsync(). If you want to load fonts globally and use them throughout the app, use
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in React-Native )
Latest Articles (in React-Native)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews