Skip to content

Instantly share code, notes, and snippets.

Niels Boecker nbckr

Block or report user

Report or block nbckr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nbckr
nbckr / SomeComponent.tsx
Last active Jul 27, 2019
TypeScript HOC (Higher-Order Component) for wrapping React components with context consumers
View SomeComponent.tsx
// Usage in other components
import { PropsWithContext, withAppContext } from "./WithAppContext";
export interface ISomeComponentProps extends PropsWithContext {
otherProp: string;
}
class SomeComponent extends Component<ISomeComponentProps> {
// or: can also extend Component<PropsWithContext> or extend Component<SomeProps & PropsWithContext>
You can’t perform that action at this time.