UNPKG

input-search-reactjs

Version:
40 lines (34 loc) 1.13 kB
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** ```js import SearchInput from 'input-search-reactjs'; ``` **2.Create state to store your matched values** ```jsx const [matchedData,setMatchedData] = useState([]); ``` **3.Props** * **data:** exisiting data (array). * **matchedValue:** function to store your matched values(function). ## Example ```jsx 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!