Copies non-react specific statics from a child component to a parent component
95
Wraps React components while hoisting eligible statics from memoized sources without copying memo internals.
$$typeof, type, compare), the wrapper retains its own displayName/propTypes/defaultProps/type and does not receive memo internals, yet exposes the source's custom static. @test.type holds the inner component), the wrapper likewise keeps its own render contract and metadata while exposing the source's custom static. @test@generates
/**
* Hoists non-React statics from a source component onto a target wrapper while respecting React.memo internals.
*
* @param {React.ComponentType} targetComponent - The wrapper component that should receive statics.
* @param {React.ComponentType} sourceComponent - The component providing statics, possibly a memoized component from React 16.11+.
* @param {Record<string, boolean>=} excludeStatics - Optional map of statics to skip during hoisting.
* @returns {React.ComponentType} The target component after hoisting.
*/
function memoSafeHoist(targetComponent, sourceComponent, excludeStatics);Hoists statics between React components while handling memo and forwardRef internals safely.
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