Overview
After navigateTo, three URL atoms stay aligned with the address bar: pathname, query object, and hash object. paramsAtom also needs the matched route pattern.
Writes are bidirectional: pathAtom.set / qsAtom.set / paramsAtom.set call navigateTo (with different default replace flags). Prefer navigateTo when setting path and query together.
Which atom for what
|
Atom
|
Holds
|
Write default
|
|---|---|---|
pathAtom
| pathname only |
replace defaults to false (push).
|
qsAtom
| query object |
replace defaults to true.
|
hashAtom
| hash object |
replace defaults to true.
|
paramsAtom
| :param values |
Needs patternsAtom; rebuilds path on write.
|
patternsAtom
| matched pattern |
Set by Router / animatedRouter.
|
path + query (two destinations)
navigateTo syncs pathAtom and qsAtom. Tiny two-route demo.
paramsAtom with Router
Two routes: / and /users/:id. patternsAtom + paramsAtom update on match.