diff --git a/docs/API.md b/docs/API.md index 374626a5..b57b7a0c 100644 --- a/docs/API.md +++ b/docs/API.md @@ -196,6 +196,25 @@ renameProp( Renames a single prop. +Example: + +```js +const enhance = compose( + withProps({ 'loadingDataFromApi': true, 'posts': [] }), + renameProp('loadingDataFromApi', 'isLoading'), + renameProp('posts', 'items'), +); + +const Posts = enhance(({ isLoading, items }) => ( +
+
Loading: { isLoading ? 'yes' : 'no'}
+ +
+)); +``` + ### `renameProps()` ```js @@ -206,6 +225,24 @@ renameProps( Renames multiple props, using a map of old prop names to new prop names. +Example: + +```js +const enhance = compose( + withProps({ 'loadingDataFromApi': true, 'posts': [] }), + renameProps({ 'loadingDataFromApi': 'isLoading', 'posts': 'items' }), +); + +const Posts = enhance(({ isLoading, items }) => ( +
+
Loading: { isLoading ? 'yes' : 'no'}
+ +
+)); +``` + ### `flattenProp()` ```js