Advertisement
Diaxon

Untitled

Apr 11th, 2024
552
0
299 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import logo from './logo.svg';
  2. import './App.css';
  3. import { useState } from 'react';
  4.  
  5. function App() {
  6.  
  7.   const [packageName, setPackageName] = useState('');
  8.   const [choice, setChoice] = useState(0);
  9.  
  10.   const handleSubmit = () => {
  11.     console.log(packageName, choice);
  12.   }
  13.   return (
  14.     <div className="App p-4">
  15.         <div class="mb-3">
  16.           <label class="form-label">ENazwa przesyłki</label>
  17.           <input class="form-control" onChange={e => setPackageName(e.target.value)}  />
  18.         </div>
  19.         <div class="border p-2">
  20.           <div class="form-check">
  21.             <input class="form-check-input" type="radio" name="choice" value={1} onChange={e => setChoice(e.target.value)}/>
  22.               <label class="form-check-label">
  23.                 Przesyłka S
  24.               </label>
  25.           </div>
  26.           <div class="form-check">
  27.             <input class="form-check-input" type="radio" name="choice" value={2}  onChange={e => setChoice(e.target.value)}/>
  28.               <label class="form-check-label">
  29.                 Przesyłka M
  30.               </label>
  31.           </div>
  32.           <div class="form-check">
  33.             <input class="form-check-input" type="radio" name="choice" value={3}  onChange={e => setChoice(e.target.value)}/>
  34.               <label class="form-check-label">
  35.                 Przesyłka L
  36.               </label>
  37.           </div>
  38.         </div>
  39.         <button type="submit" class="btn btn-primary" onClick={handleSubmit}>Dodaj</button>
  40.     </div>
  41.   );
  42. }
  43.  
  44. export default App;
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement