通用评论

Comment.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.CommentContext = undefined;
  6. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  7. exports.Comment = Comment;
  8. var _react = require('react');
  9. var _react2 = _interopRequireDefault(_react);
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. var CommentContext = _react2.default.createContext();
  12. // This function takes a component...
  13. function Comment(Component) {
  14. // ...and returns another component...
  15. return function (props) {
  16. // ... and renders the wrapped component with the context theme!
  17. // Notice that we pass through any additional props as well
  18. return _react2.default.createElement(
  19. CommentContext.Consumer,
  20. null,
  21. function (app) {
  22. return _react2.default.createElement(Component, _extends({}, props, { app: app }));
  23. }
  24. );
  25. };
  26. }
  27. exports.CommentContext = CommentContext;
  28. exports.default = Comment;
  29. //# sourceMappingURL=Comment.js.map