question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trailing underscore at params affect useParams

See original GitHub issue

Hi, I’m trying out remix-flat-routes and when I use routes with trailing underscore at params, it affects the useParams as well as params in loader / action.

I have to resort to creating a getParam abstraction but just wondering if there’s a good way to solve this within the library itself.


Just to clarify in case my description is not clear enough, for example, I have these routes:

/app/$organizationSlug.tsx
/app/$organizationSlug_/other.tsx` --> useParams() will return { organizationSlug_: "slug" }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kilimancommented, Jun 3, 2022

Thanks for the comments. I’d like to make a VS Code extension that will make it easier to create a flat route. This way you won’t have to type in the prefixes. It is easier to create routes in the original way, since you just have to create a new file inside the folder.

Other than that, I agree with you about the “pros”.

1reaction
alexluongcommented, Jun 1, 2022

Awesome! Can confirm everything is working as expected. Appreciate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trailing underscores in parameter names are dropped #519
When documenting Python parameters with trailing underscores: #!python def example(str_): """Notice that the parameter `str_` has a trailing underscore.
Read more >
UseParams is refreshing but UseEffect is not working
When you switch from one user to another, the component won't remount so: const [user, setUser] = useState(location.state);.
Read more >
useParams v6.6.1 | React Router
The useParams hook returns an object of key/value pairs of the dynamic params from the current URL that were matched by the <Route...
Read more >
Spec API (pipeline.yaml) — ploomber 0.21.8dev documentation
The params section contains an optional section called resources_ (Note the trailing underscore). By default, Ploomber marks tasks as outdated when their ...
Read more >
All Tesseract OCR options - Muthukrishnan
Name Default value Description textord_debug_tabfind 0 Debug tab finding textord_debug_bugs 0 Turn on output related to bugs in tab finding textord_testregion_left ‑1 Left edge of debug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found