Download wp-calypso/client/devdocs/devdocs-async-load/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 935 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/devdocs/devdocs-async-load/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/devdocs/devdocs-async-load/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/devdocs/devdocs-async-load/index.jsx
935 Bytes
| import PropTypes from 'prop-types'; | |
| import { PureComponent } from 'react'; | |
| import AsyncLoad from 'calypso/components/async-load'; | |
| import Placeholder from './placeholder'; | |
| export default class DevdocsAsyncLoad extends PureComponent { | |
| static defaultProps = { | |
| placeholderCount: 5, | |
| }; | |
| static propTypes = { | |
| placeholderCount: PropTypes.number, | |
| require: PropTypes.oneOfType( [ PropTypes.func, PropTypes.string ] ).isRequired, | |
| }; | |
| render() { | |
| const { placeholderCount, require, ...otherProps } = this.props; | |
| // If `component` is truthy, we're only rendering one component | |
| // (e.g. `/devdocs/blocks/login` not `/devdocs/blocks`), so we will | |
| // ignore the number of placeholders to render and just render one. | |
| const placeholders = this.props.component ? 1 : placeholderCount; | |
| return ( | |
| <AsyncLoad | |
| placeholder={ <Placeholder count={ placeholders } /> } | |
| require={ require } | |
| { ...otherProps } | |
| /> | |
| ); | |
| } | |
| } | |