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

10 lines (7 loc) 373 B
import { jsx } from 'react/jsx-runtime'; import { forwardRef } from 'react'; import { ErrorBoundary } from './ErrorBoundary.mjs'; const withErrorBoundaryForwardRef = (Component, fallback) => { return forwardRef((props, ref) => (jsx(ErrorBoundary, { fallback: fallback, children: jsx(Component, { ...props, ref: ref }) }))); }; export { withErrorBoundaryForwardRef };