Created
March 10, 2018 13:45
-
-
Save MicroBenz/b392aadd09d5252615c4af9de6e14591 to your computer and use it in GitHub Desktop.
React Context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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