MCPcopy Create free account
hub / github.com/ericclemmons/react-resolver / context

Function context

src/context.js:4–20  ·  view source on GitHub ↗
(name, type = PropTypes.any.isRequired)

Source from the content-addressed store, hash-verified

2import React from "react";
3
4export default function context(name, type = PropTypes.any.isRequired) {
5 return function contextDecorator(Component) {
6 class ContextDecorator extends React.Component {
7 static contextTypes = {
8 [name]: type,
9 }
10
11 static displayName = "ContextDecorator"
12
13 render() {
14 return <Component {...this.context} {...this.props} />;
15 }
16 }
17
18 return ContextDecorator;
19 };
20}

Callers 3

resolve.test.jsFile · 0.85
Home.jsFile · 0.85
Home.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected