Download wp-calypso/client/components/data/query-comment/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 913 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-comment/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/data/query-comment/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-comment/index.jsx
913 Bytes
| import PropTypes from 'prop-types'; | |
| import { Component } from 'react'; | |
| import { connect } from 'react-redux'; | |
| import { requestComment } from 'calypso/state/comments/actions'; | |
| export class QueryComment extends Component { | |
| static propTypes = { | |
| commentId: PropTypes.number, | |
| forceWpcom: PropTypes.bool, | |
| siteId: PropTypes.number, | |
| }; | |
| static defaultProps = { | |
| forceWpcom: false, | |
| }; | |
| componentDidMount() { | |
| this.request(); | |
| } | |
| componentDidUpdate( { siteId, commentId } ) { | |
| if ( siteId !== this.props.siteId || commentId !== this.props.commentId ) { | |
| this.request(); | |
| } | |
| } | |
| request() { | |
| const { siteId, commentId, forceWpcom } = this.props; | |
| if ( siteId && commentId ) { | |
| const query = forceWpcom ? { force: 'wpcom' } : {}; | |
| this.props.requestComment( { siteId, commentId, query } ); | |
| } | |
| } | |
| render() { | |
| return null; | |
| } | |
| } | |
| export default connect( null, { requestComment } )( QueryComment ); | |