[READ-ONLY] Mirror of https://github.com/Schniz/react-contexter. Use Context with Higher Order Components for better testing and reuse.
0

Configure Feed

Select the types of activity you want to include in your feed.

Havent tested yet. just put some code. will come back after.

Gal Schlezinger (Oct 12, 2015, 8:48 PM +0300) f8a751d5

+25
+3
.gitignore
··· 1 + *.swp 2 + *.swo 3 + node_modules
+22
lib/index.js
··· 1 + var React, { PropTypes, Component } = require('react'); 2 + 3 + function getComponentName(Component) { 4 + return Component.constructor.name || "Component"; 5 + }; 6 + 7 + export function createContextor(contextTypesObject) { 8 + return function wrapWithContext(Component) { 9 + return class ContextedComponent { 10 + static contextTypes = contextTypesObject; 11 + displayName = `Contexted(${getComponentName(Component)})`; 12 + render() { 13 + return <Component {...this.context} {...this.props} />; 14 + } 15 + } 16 + }; 17 + } 18 + 19 + export function contextor(contextTypesObject, Component) { 20 + return createContextor(contextTypesObject)(Component); 21 + } 22 +