I've been trying to load fonts in Expo, but I keep getting the same error.
This is my code:
My Index.js looks like this:
import WelcomePage from "./Authentication/WelcomePage";
export default function Page() {
return (
);
}
And my Welcomepage looks like this:
import {Link, useRouter} from "expo-router";
import {windowForm} from "../Design/WindowForm";
import {Button} from "react-native-paper";
import Styles from "../Design/styles";
import Constants from "expo-constants";
import {Inter_900Black, useFonts} from "@expo-google-fonts/inter";
const WelcomePage = () => {
const router = useRouter()
let [fontsLoaded] = useFonts({
Inter_900Black,
});
if (!fontsLoaded) {
return null;
}
return(
Hey
)
}
export default WelcomePage
This is the error I keep getting:
Warning: React has detected that the order of Hooks calls in WelcomePage has changed. If not fixed, this will lead to errors and bugs. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks
Includes the following:
Previous rendering
- useState
- useState
- useEffect
- undefined
Next rendering
- useState
- useState
- useEffect
- useState
1 answers
Thanks to Mike 'Pomax' Kamermans
I've figured out I should do an MCVE first. This way I realized that the problem was not with the font, but with my javascript windowForm().at(0) being called in the same const.
I'm not sure why yet, but when I separate them, there are no errors. I'll edit this post once I know more. Hats off to Mike.
Hot tools Tags
Hot Questions
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
20414
7
13573
4






