swsnu / swpp2020-team13

Goaling Ball: Your goal management service.
0 stars 3 forks source link

Tips for React Hooks declaration orders #25

Open ChanwooLucioLee opened 3 years ago

ChanwooLucioLee commented 3 years ago

Inside Auth.jsx in frontend, we are navigating between CreateSignupForm() and CreateLoginForm().

The thing is, both CreateSignupForm and CreateLoginForm are using React Hooks. If the order of hooks declarations in CreateSignupForm and CreateLoginForm are not consistent, it will result in mixed order of hook declarations in Auth.jsx, which invokes CreateSignupForm and CreateLoginForm.

So please be careful when you declare a hook or change the order of hooks in CreateSignupForm and CreateLoginForm.