UNPKG

@winglet/react-utils

Version:

React utility library providing custom hooks, higher-order components (HOCs), and utility functions to enhance React application development with improved reusability and functionality

12 lines (8 loc) 456 B
'use strict'; var jsxRuntime = require('react/jsx-runtime'); var react = require('react'); var ErrorBoundary = require('./ErrorBoundary.cjs'); const withErrorBoundaryForwardRef = (Component, fallback) => { return react.forwardRef((props, ref) => (jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { fallback: fallback, children: jsxRuntime.jsx(Component, { ...props, ref: ref }) }))); }; exports.withErrorBoundaryForwardRef = withErrorBoundaryForwardRef;