Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 593 Bytes

File metadata and controls

33 lines (28 loc) · 593 Bytes

defaultProps

Description

Specifies props to be passed by default to the base component. Similar to withProps(), except the props from the owner take precedence over props provided to the HoC.

API

defaultProps(
  props : Object
) : Function

Example

import Inferno from 'inferno';

import {
  compose,
  withDefaultProps
} from 'incompose';

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

export default compose(
  withDefaultProps({
    score : 100,
    name  : 'John',
  }),
)(LeaderBoard);