Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react form

const COLORS = ['white', 'red', 'blue', 'black', 'cream'];
function RegisterYourCatForm() {
  return (
    <form>
      <h2>Register Your Cat</h2>
      <label>Name*:</label>
      <input />
      <label>Color*:</label>
      <select>
        <option value="">Select color</option>
        {COLORS.map(c => <option key={c}>{c}</option>)}
      </select>
      <label>Age*:</label>
      <input />
      <label>Habits:</label>
      <textarea />
      <button type="submit">Submit</button>
    </form>
  );
}
Source by dmitripavlutin.com #
 
PREVIOUS NEXT
Tagged: #react #form
ADD COMMENT
Topic
Name
8+2 =