Skip to content

Instantly share code, notes, and snippets.

@jrwebdev
Last active June 3, 2018 02:36
Show Gist options
  • Select an option

  • Save jrwebdev/a78fcea63d2e825fbd687f8aa4023fed to your computer and use it in GitHub Desktop.

Select an option

Save jrwebdev/a78fcea63d2e825fbd687f8aa4023fed to your computer and use it in GitHub Desktop.
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