DataSeries
Published in

DataSeries

Rules for Writing React Hooks

Photo by Markus Spiske on Unsplash

React is a library for creating front end views. It has a big ecosystem of libraries that work with it. Also, we can use it to enhance existing apps.

In this article, we’ll look at some rules for writing hooks.

Only Call Hooks at the Top Level

We shouldn’t call hooks inside loops, conditions or nested functions.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store