Skip to content

Commit

Permalink
fix(factories): explicitly handle each value type
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Sep 23, 2016
1 parent 68921fe commit a567c9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ export function createShorthand(Component, mapValueToProps, val, extraProps = {}
}

// Map values to props and create a ReactElement
if (!_.isNil(val)) {
if (_.isString(val) || _.isNumber(val)) {
return <Component {...mergePropsAndClassName(mapValueToProps(val), extraProps)} />
}

// All other values return null
// React requires ReactElements or null be returned
return null
}
Expand Down

0 comments on commit a567c9b

Please sign in to comment.