Last active
June 3, 2018 02:36
-
-
Save jrwebdev/a78fcea63d2e825fbd687f8aa4023fed to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
| style: React.CSSProperties; | |
| value: number; | |
| minCounterValue?: number; | |
| maxCounterValue?: number; | |
| } | |
| const Counter = (props: CounterProps) => ( | |
| <MakeCounter | |
| minValue={props.minCounterValue} | |
| maxValue={props.maxCounterValue} | |
| > | |
| {injectedProps => ( | |
| <div> | |
| <div>Some other value: {props.value}</div> | |
| <div style={props.style}> | |
| <button onClick={injectedProps.onDecrement}> - </button> | |
| {injectedProps.value} | |
| <button onClick={injectedProps.onIncrement}> + </button> | |
| </div> | |
| {props.minCounterValue !== undefined ? ( | |
| <div>Min value: {props.minCounterValue}</div> | |
| ) : null} | |
| {props.maxCounterValue !== undefined ? ( | |
| <div>Max value: {props.maxCounterValue}</div> | |
| ) : null} | |
| </div> | |
| )} | |
| </MakeCounter> | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment