okay so I have this form where the user can query a search with type "radio buttons" search input and a react-select filled with categories, the button works as a link front end form for clarification
{selectedOption ?
<Link to={`/annonser${typeToRoute}${selectedOptionToRoute}${searchToRoute}`} >
<button>Hitta annons / mönster</button>
</Link>: <Link to={`/annonser${typeToRoute}${searchToRoute}`} >
<button>Hitta annons / mönster</button>
where I then want to query db to get data based on the url params with useParams hook and then set the state
const { type, category, search} = useParams();
const categoryRef = db.collection("articles").where("subCategory", "==", category)
I want the user to be able to search any of the alternatives seperatly aswell I will not use any form validation to make sure the user have everything not null. Is this the right way to go about it? Because you cant have optional params in route component in v6 for some reason? Is there any other way to achieve what im trying to do or am I on the right track? Thanks in advance never done anything like this before. Let me know if my question is asked poorly since I dont have alot of experience asking questions here.
path="/annonser/:type/:category/:search", and you want the path params to be optional? If these are optional it might be better to instead use queryString parameters if you just need to access potentially undefined values for the DB query. I.e.path="/annonser"and a URL like"/annonser?type=....&category=....&search=....".