input-search-reactjs
v1.0.1
Published
A simple search/filter component
Downloads
23
Maintainers
Readme
This package is a distribution of search-input, compiled for searching items.
🛠 Installation
You can install input-search-reactjs by using npm install input-search-reactjs or npm i input-search-reactjs which will provide
access to searching the data easier.
1.Import the package
import SearchInput from 'input-search-reactjs';2.Create state to store your matched values
const [matchedData,setMatchedData] = useState([]);3.Props
- data: exisiting data (array).
- matchedValue: function to store your matched values(function).
Example
function App(){
const data = ['example','data']; //existing data
const [matchedData,setMatchedData] = useState([]);
return(
<div>
<SearchInput data={data} matchedValue={(e)=>setMatchedData(e)}/>
{
matchedData.map((value)=>(
<p>{value}</p> //matched data compared with existing data
))
}
</div>
)
}🤝 Show your support
Give a ⭐ if this package helped you!
