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

Forums ReactWhat are the rules that must be followed while using React Hooks?
Staff asked 2 years ago

Answers (1)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 2 years ago

There are two principles that must be observed when coding using Hooks:

Only at the top level should React Hooks be called. It is not permitted to invoke them within nested functions, loops, or conditions.

Only React Function Components are permitted to invoke Hooks.

Subscribe

Select Categories