map-props-callbag

1.0.1 • Public • Published

map-props-callbag

Map callbag to your props (reactjs component)

Inspirated from mapProps from recompose.

This project is just a try out, but you can install the HoC with: yarn add map-props-callbag and feel free to open PR to discuss :)

API

import mapPropsCallbag from 'map-props-callbag'
import Component from './component' // your react component

export default mapPropsCallbag((props$) => {
  // props$  is a callbag
  // here you can write all your callbag behaviour

  // you should return a new callbag
  // parent props should be merge by yourself here if you want to keep them
  return pipe(
    props$,
    map(props => ({
      ...props,
      some: 'other prop',
    }))
  )
})(Component)

/map-props-callbag/

    Package Sidebar

    Install

    npm i map-props-callbag

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    2.13 kB

    Total Files

    3

    Last publish

    Collaborators

    • fabienjuif