Preload custom fonts in React
Oct 3, 2021
Problem: When a custom font is not rendered at the beginning by the init state, if a state is updated and we need to render this font, it won’t be properly rendered as expected. It is rendered in other default font family.
Solution:
Web Font Loader
useEffect(() => { WebFont.load({ custom: { families: FONTS_FAMILY_NAMES, urls: ['../assets/fonts/stylesheet.css'], }, });}, []);