Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import PropTypes from 'prop-types';
- class UIKitContext extends Component {
- getChildContext() {
- return {
- path: (image, type) => `${this.props.prefixPath}/${type}/${image}`
- };
- }
- render() {
- return (
- <div>{this.props.children}</div>
- );
- }
- }
- UIKitContext.propTypes = {
- children: PropTypes.element,
- prefixPath: PropTypes.string
- };
- UIKitContext.childContextTypes = {
- path: PropTypes.func
- };
- export default UIKitContext;
Add Comment
Please, Sign In to add comment