Skip to content

Instantly share code, notes, and snippets.

@MicroBenz
Created March 10, 2018 13:45
Show Gist options
  • Save MicroBenz/b392aadd09d5252615c4af9de6e14591 to your computer and use it in GitHub Desktop.
Save MicroBenz/b392aadd09d5252615c4af9de6e14591 to your computer and use it in GitHub Desktop.
React Context
import React from 'react';
import PropTypes from 'prop-types';
const Image = (props, context) => (
<img src={context.path(props.image, 'thumbnails')} />
);
Image.propTypes = {
image: PropTypes.string
};
Image.contextTypes = {
path: PropTypes.func
};
export default Image;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment