Skip to content

Instantly share code, notes, and snippets.

@mbohgard
mbohgard / hoc.tsx
Created Jan 30, 2019
TypeScript HOC
View hoc.tsx
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 Aug 4, 2016
MobX implementation
View todoStore.js
// todoStore.js
class TodoStore {
@observable todos = []
getTodos = () => {
return this.todos
}
getTodo = id => {
You can’t perform that action at this time.