Skip to main content
Public

Share visualization

Loading preview…

[VizStudy]Week6: Menus with React

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

[VizStudy]Week6: Menus with React

0
Hhotdoujiang
Last edited Oct 27, 2019
Created on Oct 25, 2019
Forked from React Starter

This example demonstrates a pet-selection menu built with React, allowing users to choose among Goldfish, Dog, or Cat from a dropdown. The selected value is tracked via the `useState` hook and displayed in the console, while a custom `Dropdown` component maps over option objects to render `<option>` elements. The app uses ReactDOM to render the interface, with the menu styled at a large font size using `rem` units in the HTML. It relies on React 16.9’s production UMD build and follows a starter-code pattern from a lecture.

AI-generated description

React starter code following Curran's lecture <br>

  • use 'rem' to change font size of menu if 'em' don't works
  • pass in 'options' as property to the dropdown menu function
  • use state to track the selected value
  • set a initial value to the usestate()

Finished!

Comments

Sign in to join the discussion.

MIT Licensed