Create a Billing Form

Link to chapter -

What is the purpose of the statement
isLoading = isProcessing || isLoading;
in the BillingForm function body

function BillingForm({ isLoading, onSubmit, ...props }) {
  const [fields, handleFieldChange] = useFormFields({
    name: "",
    storage: ""
  const [isProcessing, setIsProcessing] = useState(false);
  const [isCardComplete, setIsCardComplete] = useState(false);

  isLoading = isProcessing || isLoading;

Won’t this always just result in isLoading = isLoading?
Or do react state hook initializations get skipped when functional components re-render?

Well we call setIsProcessing later on in the guide. That’ll cause the isProcessing flag to change.

1 Like