Skip to content

Instantly share code, notes, and snippets.

@jrwebdev
Last active June 3, 2018 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrwebdev/c0392dfc25d3fc30893f324a89c8a16d to your computer and use it in GitHub Desktop.
Save jrwebdev/c0392dfc25d3fc30893f324a89c8a16d to your computer and use it in GitHub Desktop.
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