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

React · Theory

Dropdown in React

← All stacks

Theory

68/94

Dropdown in React

Controlled <select value={city} onChange={e => setCity(e.target.value)}> with <option> children. Same idea as an input. Custom dropdowns (div + keyboard) are extra a11y work — native select is the viva answer unless they ask for a design-system menu.

Dropdown in React — start Pune. Pick Delhi → state Delhi. Uncontrolled select is harder to test.

Exam tip

Controlled <select>.

Example

// Select
import { useState } from "react";

export default function City() {
  const [city, setCity] = useState("Pune");
  return (
    <select value={city} onChange={(e) => setCity(e.target.value)}>
      <option>Pune</option>
      <option>Delhi</option>
    </select>
  );
}

Dropdown in React — start Pune. Pick Delhi → state Delhi. Uncontrolled select is harder to test.

Short notes

  • DefControlled select.
  • RuleValue + onChange.
  • RememberNative first.

Questions

1

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

2

Write 5–10 lines that use Dropdown and say what the UI does.

3

What mistake do freshers make with Dropdown?

Previous← Famous React AppsNextComposition vs Inheritance 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.