ChainverseOS is a TypeScrip library to implement a powerfull search engine
npm install @chainverse/os
yarn add @chainverse/os
Receive the backendURI as property and YourSearchComponent as children
You need to wrap YourSearchComponent with SearchOSClientProvider
Sets the number of results to get with each extra load of data
fetchMore?.({ limit: int }):
The limit property of SearchOS sets the number of results to get on the first data load.
limit={ int }
Connection address to the backend of your app
Sent as property to SearchOSClientProvider
import React, { useState } from 'react';
import * as ReactDOM from 'react-dom';
import SearchOSClientProvider, {
SearchOS,
useSearchOSClient,
} from '@chainverse/os';
import '../dist/chainverse-os.css';
const YourSearchComponent = () => {
const { fetchMore } = useSearchOSClient();
const handleMore = async () => {
await fetchMore?.({ limit: int });
};
return (
<>
<SearchOS
placeholder="placeholder"
limit={ int }
/>
</>
);
};
const App = () => {
const backendURI = 'http://YourBackendURI';
return (
<div>
<SearchOSClientProvider backendURI={backendURI}>
<YourSearchComponent />
</SearchOSClientProvider>
</div>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
npm run build
npm start