制御されていない `<select>` 要素

ReactReactBeginner
今すぐ練習

This tutorial is from open-source community. Access the source code

💡 このチュートリアルは英語版からAIによって翻訳されています。原文を確認するには、 ここをクリックしてください

はじめに

この実験では、コールバック関数を使ってReactで制御されていない<select>要素を作成し、その値を親コンポーネントに渡す方法を学びます。<select>要素の初期値を設定するためにselectedValueプロップを使い、新しい値を親に送信するためにonChangeイベントを使います。この実験では、渡された各値に対して<option>要素を作成するためにArray.prototype.map()をどのように使うかも説明します。


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL react(("React")) -.-> react/FundamentalsGroup(["Fundamentals"]) react/FundamentalsGroup -.-> react/jsx("JSX") react/FundamentalsGroup -.-> react/event_handling("Handling Events") react/FundamentalsGroup -.-> react/list_keys("Lists and Keys") subgraph Lab Skills react/jsx -.-> lab-38360{{"制御されていない `` 要素"}} react/list_keys -.-> lab-38360{{"制御されていない `