Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 553 Bytes

renameProps.md

File metadata and controls

31 lines (27 loc) · 553 Bytes

renameProps

Description

Renames multiple props, using a map of old prop names to new prop names.

API

renameProps(
  nameMap: { [key : string] : string }
) : Function

Example

import {
  compose,
  renameProp
} from 'incompose';

const LeaderBoard = (props) => (
  <div>
    <h1>{props.name} has a score of {props.score}</h1>
  </div>
);

export default compose(
  renameProps({
    count     : 'score',  // rename prop `count` to `score`
    lastName  : 'name',   // rename prop `lastName` to `name`
  }),
)(LeaderBoard);