Skip to content

Latest commit

 

History

History
30 lines (26 loc) · 519 Bytes

mapProps.md

File metadata and controls

30 lines (26 loc) · 519 Bytes

mapProps

Description

Applies a mapper function, which transforms the original props into a new props object.

API

mapProps(
  (props) => Object
) : Function

Example

import {
  compose,
  mapProps
} from 'incompose';

const DiscountPriceIndicator = ({ discountPrice }) => (
  <div>
    <h1>Discount price: {discountPrice}</h1>
  </div>
);

export default compose(
  mapProps(({ price, discount }) => ({
    discountPrice: price - price * (discount / 100)
  })),
)(DiscountPriceIndicator);