OptionalParams in route not working
I'm not getting the expected result using optional params
- routes
-- users
---- [[id]].tsx
---- index.tsx
-- [...404].tsx
url: http://localhost:3000/users/1/2
[[id]].tsx
It is routing to [...404]7 Replies
It's working as expected:
-
/users/1
-> id
= 1
- /users/1/2
-> page not found (there is no path to (/users/1)/2
)
Maybe you are looking for src/routes/users/[...id].tsx
Then I am misunderstanding https://docs.solidjs.com/solid-start/building-your-application/routing#optional-parameter
?
OK looks like I'm wrong.
Compare with this
SolidStart Release Candidate Documentation
SolidStart Release Candidate Documentation
Early release documentation and resources for SolidStart Release Candidate
I think optional simply means no need for
index.tsx
and [id].tsx
; just use [[id]].tsx
instead.
To my knowledge /users/1/2
would require a catch-all routeLogical. But in that case the doc seems to be wrong because in testing that it matches
/users
and /users
/1 but not /users/1.2
. I'll ask the cocs team.