How to use the react-formal.Button function in react-formal

To help you get started, we’ve selected a few react-formal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MoveOnOrg / Spoke / src / components / forms / GSForm.jsx View on Github external
} else if (child.type === Form.Field) {
        const name = child.props.name;
        let error = this.state.formErrors ? this.state.formErrors[name] : null;
        let clonedElement = child;
        if (error) {
          error = error[0]
            ? error[0].message.replace(name, child.props.label)
            : null;
          clonedElement = React.cloneElement(child, {
            errorText: error
          });
        }
        return React.cloneElement(clonedElement, {
          events: ["onBlur"]
        });
      } else if (child.type === Form.Button) {
        return React.cloneElement(child, {
          component: GSSubmitButton,
          isSubmitting: this.state.isSubmitting
        });
      } else if (child.props && child.props.children) {
        return React.cloneElement(child, {
          children: this.renderChildren(child.props.children)
        });
      }
      return child;
    });
  }

react-formal

Classy HTML form management for React

MIT
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis