1.0.16 • Published 2 years ago
react-search-query v1.0.16
React Search Query
A lightweight library for working with search queries in react
React search query allows you to get the search params in the URL with a single line of code.
Installation
React-search-query requires a window to run. If you're using a Next application, wrap the method in useEffect.
yarn add react-search-query
yarn start
npm install react-search query
npm start
Usage
To use react-search-query in a react application, import the package and initialise:
import { Query } from "react-search-query"
const App = () => {
const query = Query()
console.log(query)
}
To use react-search-query in a next application, import the package and intiailise in useEffect:
import { Query } from "react-search-query"
import { useState, useEffect } from "react"
const App = () => {
const [state, setState] = useState({})
useEffect(() => {
const query = Query()
setState(query)
}, [])
console.log(state)
}
Repository
Check out the public repository here