Geek Culture
Published in

Geek Culture

The useState Hook in ReactJS

State: hooked.

Just a big fat hook. [Image source]

In this post I’ll be making a quick intro to the useState hook, as well as giving some tips when using it.

useState basics

The useState hook is the most commonly used hook in ReactJS, and helps us with two things:

  • It preserves the value of a variable between renders.

--

--

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