Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mbohgard
mbohgard / hoc.tsx
Created January 30, 2019 12:35
TypeScript HOC
export type WithProps = {
prop: SomeType;
};
const value: SomeType = true;
export const withProp = <P extends WithProps>(
Component: React.ComponentType<P>
): React.SFC<Subtract<P, WithProps>> => props => (
return value ? (
@mbohgard
mbohgard / todoStore.js
Created August 4, 2016 21:46
MobX implementation
// todoStore.js
class TodoStore {
@observable todos = []
getTodos = () => {
return this.todos
}
getTodo = id => {