passing-through

1.0.0 • Public • Published

passing-through

The passing-through library is a component library that allows you to easily transform child components through modifiers.

Installation

The module is released in the public npm registry and can be installed by running:

npm install --save passing-through

API

The passing-through library exposes 2 components:

import { Pass, Through } from 'passing-through';

const modifiers = {
  foo: [
    function(props, passedProps, child) {
      props.className = 'red';

      console.log(passedProps) // { foo: true }
      if (props.span) return <span>Changed</span>
    }
  ]
}

<Pass foo modify={ modifiers }>
  <Through span>
    <div>
  </Though>
</Pass>

// Renders <span className='red'>Changed</span>

Pass

The pass module used to configure the modifiers that get applied to children of the Through component. The most important property of this component is the modify prop which stores the modifers that get applied.

The modify prop is an object where the key is the name of a property is should trigger on, and the value an array of functions that need to be executed.

Through

This component will apply all the modifications that are provided to the Pass component.

License

MIT

Package Sidebar

Install

npm i passing-through

Weekly Downloads

14

Version

1.0.0

License

MIT

Unpacked Size

13.9 kB

Total Files

6

Last publish

Collaborators

  • 3rdeden