CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-hoist-non-react-statics

Copies non-react specific statics from a child component to a parent component

95

1.09x
Overview
Eval results
Files

task.mdevals/scenario-9/

Chainable Static Wrapper

Build a helper that wraps React components while preserving their custom static properties and keeps wrappers chainable for fluent higher-order composition.

Capabilities

Copies statics to wrapper

  • Custom static method and value from a source component remain accessible on the returned wrapper. @test
  • Symbol-based static metadata is preserved on the returned wrapper. @test

Supports excluding statics

  • When an exclusions map flags a static key, the returned wrapper omits that static while leaving other statics intact. @test

Returns wrapper for chaining

  • The helper returns the same wrapper component instance passed in so subsequent wrapping calls can reuse it; chaining two wrappers still exposes statics from the original source plus additions from the first wrapper. @test

Implementation

@generates

API

/**
 * Copies non-React-specific statics from a source component to a wrapper and returns the wrapper for further composition.
 * @param {object} wrapperComponent - The component receiving statics.
 * @param {object|string} sourceComponent - The component providing statics. If a string tag is provided, no statics are copied.
 * @param {Record<string, boolean>} [exclusions] - Keys to skip when hoisting statics.
 * @returns {object} The same wrapperComponent, ready for additional wrapping.
 */
export function chainableWrap(wrapperComponent, sourceComponent, exclusions);

Dependencies { .dependencies }

hoist-non-react-statics { .dependency }

Copies static properties between React components while respecting React-reserved statics.

Install with Tessl CLI

npx tessl i tessl/npm-hoist-non-react-statics

tile.json