I have a home page with a few inputs and a search button. When the search button (which is a react-router <Link /> component) is clicked, it routes to my /search route. I need access to the search terms that were entered in the previous route to query my database and display the results.
How can I pass the search terms through either the <Link /> component or some other way through the route so that the /search route and component has access to them?
I’ve edited my router to include variables in the path and pass them as a string in the <Link /> components to prop. I can then access those variables in the url via this.props.params.*. This does however seem to affect the paths to local directories (like images in /public) as well as the the href of the <Link />s underlying anchor element. Is this the standard pattern for a search feature?