PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

React · Theory

What is useState?

← All stacks

Theory

64/94

What is useState?

In one line: useState is how a function component remembers a value between renders. Without it, every render would reset let n = 0. With it, n survives and the UI can change.

It is a hook — a function whose name starts with use. React only lets you call hooks in components (or other hooks). That is why the question is worded ‘what is the useState in React’ — they want hook + memory + re-render, not a blog slogan.

What is useState? — on screen — Hello Asha. useState holds name inside the function component.

Diagram
useState(false)
      │ click
      ▼
  setLiked(true)
      │
      ▼
   Like → Liked
Exam tip

Memory between renders + setter.

Example

// What is useState
import { useState } from "react";

export default function NameBox() {
  const [name, setName] = useState("Asha");
  return <p>Hello {name}</p>;
}

What is useState? — on screen: Hello Asha. useState holds name inside the function component.

Short notes

  • DefRemembers a value across renders.
  • RuleHook, top-level, function components.
  • TrapTreating it like a normal let.

Questions

1

What problem does useState solve vs a plain let?

Previous← Pagination in ReactNextTime Picker in React →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.