Let's build 2 hooks to manage Next.js Queries

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • Bugged.dev

    My own weblog, feel free to fork.

  • The state needs to be up-to-date with the query too, and this can be done with listening to asPath( I'm not sure about this solution's performance, if you have better one, comment meπŸ˜…).

  • contextism

    😍 Use React Context better.

  • I always struggled with such problems, and I made a package from one of them once, So If you wanted to make a npm package from this idea, no problem, I'll be the first one to use it.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • query-string

    Parse and stringify URL query strings

  • In useState we pass a callback, It's called lazy initialization, and it's a perfect thing for performance. Query-string package is so useful, we use it to parse the asPath string, But if you don't like to use foreign libraries, you can implement your algorithm. If we pass our initial query to the hook, it will be mixed with the url-based initial query, then we set the query in the url. So:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts