Advertisement
hsianghui

FormSelect.js

Nov 28th, 2023 (edited)
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function FormSelect({
  2.   labelId,
  3.   labelCaption,
  4.   selectedValue,
  5.   selectData,
  6.   onChange,
  7. }) {
  8.   const options = selectData.map((value, index) => {
  9.     return (
  10.       <option key={index} value={value}>
  11.         {value}
  12.       </option>
  13.     );
  14.   });
  15.  
  16.   return (
  17.     <div className="row">
  18.       <div className="col-25">
  19.         <label htmlFor={labelId}>{labelCaption}</label>
  20.       </div>
  21.       <div className="col-75">
  22.         <select id={labelId} onChange={onChange} value={selectedValue}>
  23.           {options}
  24.         </select>
  25.       </div>
  26.     </div>
  27.   );
  28. }
  29.  
  30. export default FormSelect;
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement