1. 'use client';
    
  2. 
    
  3. import * as React from 'react';
    
  4. import {useFormStatus} from 'react-dom';
    
  5. import ErrorBoundary from './ErrorBoundary.js';
    
  6. 
    
  7. const h = React.createElement;
    
  8. 
    
  9. function Status() {
    
  10.   const {pending} = useFormStatus();
    
  11.   return pending ? 'Saving...' : null;
    
  12. }
    
  13. 
    
  14. export default function Form({action, children}) {
    
  15.   const [isPending, setIsPending] = React.useState(false);
    
  16.   return h(
    
  17.     ErrorBoundary,
    
  18.     null,
    
  19.     h(
    
  20.       'form',
    
  21.       {
    
  22.         action: action,
    
  23.       },
    
  24.       h(
    
  25.         'label',
    
  26.         {},
    
  27.         'Name: ',
    
  28.         h('input', {
    
  29.           name: 'name',
    
  30.         })
    
  31.       ),
    
  32.       h(
    
  33.         'label',
    
  34.         {},
    
  35.         'File: ',
    
  36.         h('input', {
    
  37.           type: 'file',
    
  38.           name: 'file',
    
  39.         })
    
  40.       ),
    
  41.       h('button', {}, 'Say Hi'),
    
  42.       h(Status, {})
    
  43.     )
    
  44.   );
    
  45. }