TLDR Web Dev · ARTICLES & TUTORIALS

HOW TO CONTROL A REACT COMPONENT WITH THE URL

buildui.com9 min read

Summary from the TLDR Web Dev newsletter

React components can be controlled with the URL. An example is shown in this post where URL query parameters are used as the single source of truth for component state, making sure the component and URL stay in sync across different actions. The useSearchParams Next.js hook is used to read and update the URL parameters.