casted-react-search
v1.1.7
Published
Provides search components to interact with Elastic App Search
Downloads
4
Keywords
Readme
casted-react-search
A React component to search Casted account content
Install
npm install --save casted-react-search
Usage
import React, { useState } from 'react'
import { SearchInput, SearchResults } from 'casted-react-search'
import 'casted-react-search/dist/index.css'
const ExampleComponent = () => {
const [isSearchOpen, setIsSearchOpen] = useState(false)
// The history value should be pulled in from router library
const history = null
return (
<>
<SearchInput onClick={() => setIsSearchOpen(true)} />
<SearchResults
searchKey='elastic-search-key'
engineName='elastic-engine-name'
endpointBase='elastic-endpoint-base'
history={history}
onResultClick={() => setIsSearchOpen(false)}
/>
</>
)
}
Development
When needing to develop this library, you can utilize the test environment located in /example
. The test environment will automatically pull in the casted-react-search
library.
To build casted-react-search
, run:
npm run build
To build and watch casted-react-search
, run:
npm run start
License
MIT © maindaniel