Last active
June 3, 2018 02:29
-
-
Save jrwebdev/c0392dfc25d3fc30893f324a89c8a16d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface CounterProps extends InjectedCounterProps { | |
style: React.CSSProperties; | |
} | |
const Counter = (props: CounterProps) => ( | |
<div style={props.style}> | |
<button onClick={props.onDecrement}> - </button> | |
{props.value} | |
<button onClick={props.onIncrement}> + </button> | |
</div> | |
); | |
interface WrappedCounterProps extends CounterProps { | |
minValue?: number; | |
maxValue?: number; | |
} | |
const WrappedCounter = ({ | |
minValue, | |
maxValue, | |
...props | |
}: WrappedCounterProps) => ( | |
<MakeCounter minValue={minValue} maxValue={maxValue}> | |
{injectedProps => <Counter {...props} {...injectedProps} />} | |
</MakeCounter> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment