Copies non-react specific statics from a child component to a parent component
95
Create a wrapper helper for React.forwardRef components that preserves custom statics while avoiding forward-ref internals.
version and a Symbol-keyed meta object) on the returned wrapper. @testdisplayName and defaultProps after hoisting and does not surface the source component's $$typeof or render properties. @testonRender callback exactly once per render while passing through props. @test@generates
import React from "react";
/**
* Wraps a React.forwardRef component with an optional render logger,
* while preserving custom statics without copying forward-ref internals.
*
* @param {React.ForwardRefExoticComponent<any>} component forwardRef component to wrap
* @param {(props: object) => void} onRender optional callback invoked on render
* @returns {React.ForwardRefExoticComponent<any>} wrapped forwardRef component
*/
export function withForwardRefStatics(component, onRender);Provides creation of forwardRef wrappers and elements.
Hoists non-React statics from a source component onto a wrapper while respecting forwardRef internals.
Install with Tessl CLI
npx tessl i tessl/npm-hoist-non-react-staticsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10