Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
next-query-params
Advanced tools
A small wrapper for use-query-params
in Next.js apps.
npm install next-query-params
// _app.js
import {NextQueryParamProvider} from 'next-query-params';
export default function App({ Component, pageProps }) {
return (
<NextQueryParamProvider>
<Component {...pageProps} />
</NextQueryParamProvider>
);
}
Please refer to the usage of use-query-params
. This library only configures the provider for usage with Next.js and additionally re-exports all modules from use-query-params
for convenience. Note that use-query-params
and query-string
is bundled in this library to support IE11.
import { useQueryParam, StringParam, withDefault } from 'next-query-params';
export default function IndexPage() {
const [name, setName] = useQueryParam('name', withDefault(StringParam, ''));
function onNameInputChange(event) {
setName(event.target.value);
}
return (
<p>My name is <input value={name} onChange={onNameInputChange} /></p>
);
}
// Note that if query parameters affect the server-rendered HTML of the page,
// you should define this function. Statically generated pages only have
// access to query parameters on the client side.
export function getServerSideProps() {
return {props: {}};
}
This library is just a small wrapper around use-query-params
by Peter Beshai and uses the code that was collaboratively created in use-query-params#13. I mostly moved the code to a reusable library.
FAQs
Convenient state management of query parameters in Next.js apps.
The npm package next-query-params receives a total of 29,017 weekly downloads. As such, next-query-params popularity was classified as popular.
We found that 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 0 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.