acdlite/flummox

View on GitHub
src/addons/__tests__/addContext.js

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react';

export default function addContext(Component, context, contextTypes) {
  return React.createClass({
    childContextTypes: contextTypes,

    getChildContext() {
      return context;
    },

    render() {
      return <Component {...this.props} />;
    }
  });
}