Download react-boilerplate/app/components/Img/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 510 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/components/Img/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-boilerplate/app/components/Img/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/components/Img/index.js
510 Bytes
| /** | |
| * | |
| * Img.js | |
| * | |
| * Renders an image, enforcing the usage of the alt="" tag | |
| */ | |
| import React from 'react'; | |
| import PropTypes from 'prop-types'; | |
| function Img(props) { | |
| return <img className={props.className} src={props.src} alt={props.alt} />; | |
| } | |
| // We require the use of src and alt, only enforced by react in dev mode | |
| Img.propTypes = { | |
| src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired, | |
| alt: PropTypes.string.isRequired, | |
| className: PropTypes.string, | |
| }; | |
| export default Img; | |