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

React · Theory

React Component API

← All stacks

Theory

17/94

React Component API

Component API means the methods React gives a class: setState, forceUpdate, render. setState merges object state (shallow) and schedules render. forceUpdate re-renders without changing state — almost never needed; it’s a smell.

Hooks world: useState / useReducer replace setState. There is no forceUpdate. If a fresher recites forceUpdate as daily API, steer them back to ‘fix the state, don’t force paint’.

React Component API — output — class vs hooks. Interview: name setState, then say we use useState now.

Diagram
Parent
    │ props (read-only)
    ▼
  Child → UI
Exam tip

setState vs useState. Avoid forceUpdate.

Example

// Component API
console.log("class : this.setState / this.forceUpdate");
console.log("hooks : useState / useReducer");
console.log("don't : call setState in render forever");

React Component API — output: class vs hooks. Interview: name setState, then say we use useState now.

Short notes

  • Class : setState, render, rare forceUpdate.
  • Hooks : useState / useReducer.
  • TrapforceUpdate as a habit.

Questions

1

Explain React Component API as if you are teaching a junior — definition, then one tiny UI.

2

What does the example show on screen (or print), and what does that prove?

3

What mistake do freshers make with React Component API?

Previous← Constructor in ReactNextReact Component Lifecycle →
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.