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

React · Theory

Buttons in React

← All stacks

Theory

59/94

Buttons in React

A button is still HTML. In React: type="button" inside forms so it doesn’t submit, onClick={handler}, disabled={busy}, label from state (Save / Saving…). Extract <Button> when the same styles repeat. That’s it — don’t over-abstract a native control on day one.

Buttons in React — on screen — Save. busy true → Saving… and disabled. type=button so it doesn’t submit a parent form.

Exam tip

type, onClick, disabled.

Example

// Button
export default function Save({ busy }) {
  return (
    <button type="button" disabled={busy} onClick={() => console.log("save")}>
      {busy ? "Saving…" : "Save"}
    </button>
  );
}

Buttons in React — on screen: Save. busy true → Saving… and disabled. type=button so it doesn’t submit a parent form.

Short notes

  • type=button in forms.
  • onClick + disabled from state.
  • Trapdefault submit type.

Questions

1

Explain Buttons 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 Buttons?

Previous← React vs SvelteNextVirtual DOM 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.