Raja Muhammad Asher
Raja Muhammad Asher

Raja Muhammad Asher

What are the rules that must be followed while
using React Hooks?

Photo by Lautaro Andreani on Unsplash

What are the rules that must be followed while using React Hooks?

Raja Muhammad Asher's photo
Raja Muhammad Asher
·Aug 31, 2022·

1 min read

Only Call Hooks at the Top Level

Don’t call Hooks inside loops, conditions, or nested functions.

Only Call Hooks from React Functions

Don’t call Hooks from regular JavaScript functions.

Sources:

Rules of Hooks –. (n.d.). React. reactjs.org/docs/hooks-rules.html

 
Share this