Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@reverecre/next-query-params
Advanced tools
@reverecre/next-query-params
enum QueryParamKind
Members:
STRING
: Immediately flushed single string value.STRING_DEFERRED
: String value that uses local state updates and defers updating the URL.STRING_LIST
: Value is set multiple times in the URL, decoded as a list.STRING_SET
: Value is set multiple times in the URL, decoded as a set.STRING_LIST_DEFAULT_UNDEFINED
: Value is undefined when not present, a list when it is.STRING_REQUIRED
: String value that will throw an error if not found.NUMBER
: Parsed and serialized as a number.NUMBER_DEFERRED
: Number value that uses local state updates and defers updating the URL.parseQuery
Returns a normalized value of a parsed query param object.
Example Usage
import { parseQuery, QueryParamKind } from "@reverecre/next-query-params";
const { sortDir } = parseQuery(req.query, {
sortDir: QueryParamKind.STRING,
});
QueryParamsProvider
Provides an application with the shared query parameter state. This is used to sync deferred updates across the application.
useQueryParams
A hook that reads from Next.js's useQuery
and returns read, write, and reset functions.
Example Usage
import {
QueryParamKind,
QueryParamsProvider,
useQueryParams,
} from "@reverecre/next-query-params";
function MyApp() {
return (
<QueryParamsProvider>
<MyComponent />
</QueryParamsProvider>
);
}
function MyComponent() {
const [query, setQuery, resetQuery] = useQueryParams({
sortDir: QueryParamKind.STRING,
sortBy: QueryParamKind.STRING,
search: QueryParamKind.STRING_DEFERRED,
selectedOptions: QueryParamKind.STRING_SET,
});
const updateSearch = useCallback(
(next: string) => {
setQuery({ search: next });
},
[setQuery]
);
// ...
}
FAQs
## API
We found that @reverecre/next-query-params demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.