Guest User

Untitled

a guest
Mar 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import PropTypes from 'prop-types';
  3.  
  4. class UIKitContext extends Component {
  5. getChildContext() {
  6. return {
  7. path: (image, type) => `${this.props.prefixPath}/${type}/${image}`
  8. };
  9. }
  10.  
  11. render() {
  12. return (
  13. <div>{this.props.children}</div>
  14. );
  15. }
  16. }
  17.  
  18. UIKitContext.propTypes = {
  19. children: PropTypes.element,
  20. prefixPath: PropTypes.string
  21. };
  22.  
  23. UIKitContext.childContextTypes = {
  24. path: PropTypes.func
  25. };
  26.  
  27. export default UIKitContext;
Add Comment
Please, Sign In to add comment