kitze / mobx-router

A simple router for MobX + React apps
509 stars 66 forks source link

null || '' ?? #119

Closed romazhan closed 2 years ago

romazhan commented 2 years ago

https://github.com/kitze/mobx-router/blob/d8b65c6b7253b233d3e4ef01c7c6535e1d45339d/src/start-router.ts#L44

thdk commented 2 years ago

@polak228 Can you give some more info on this issue? Are you experiencing problems with this line?

romazhan commented 2 years ago

Why write null || "?

thdk commented 2 years ago

Ah that's indeed a bit silly 🙂

So it's always ''

Is there a better value than empty string for this argument?

romazhan commented 2 years ago

Write just '', it will work faster by 0.0001 seconds

thdk commented 2 years ago

Yes, according to the docs https://developer.mozilla.org/en-US/docs/Web/API/History/pushState it should be empty string as this value is never used and exists only for historical reasons.

Feel free to submit a PR.

Still not sure how you stumbled on this line though but that's none of my business :)

romazhan commented 1 year ago

It's just that sometimes I like to dig into someone else's code