Download react-instantsearch/examples/server-side-rendering/src/App.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/examples/server-side-rendering/src/App.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/examples/server-side-rendering/src/App.js
-
curl -L -o App.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/examples/server-side-rendering/src/App.js
1.14 kB
| import React, { Component } from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import { | |
| InstantSearch, | |
| RefinementList, | |
| SearchBox, | |
| Hits, | |
| Configure, | |
| CurrentRefinements, | |
| } from 'react-instantsearch-dom'; | |
| class App extends Component { | |
| static propTypes = { | |
| indexName: PropTypes.string.isRequired, | |
| searchClient: PropTypes.object.isRequired, | |
| searchState: PropTypes.object, | |
| resultsState: PropTypes.oneOfType([ | |
| PropTypes.arrayOf(PropTypes.object), | |
| PropTypes.object, | |
| ]), | |
| }; | |
| static defaultProps = { | |
| searchState: {}, | |
| }; | |
| state = { | |
| searchState: this.props.searchState, | |
| }; | |
| onSearchStateChange = (nextSearchState) => | |
| this.setState({ searchState: nextSearchState }); | |
| render() { | |
| const { searchState } = this.state; | |
| return ( | |
| <InstantSearch | |
| {...this.props} | |
| searchState={searchState} | |
| onSearchStateChange={this.onSearchStateChange} | |
| > | |
| <Configure hitsPerPage={3} /> | |
| <SearchBox /> | |
| <CurrentRefinements /> | |
| <RefinementList attribute="brand" /> | |
| <Hits /> | |
| </InstantSearch> | |
| ); | |
| } | |
| } | |
| export default App; | |