Let's say we changed :section in the route. Then the above helper also gets rerun. If we add a query param to the URL, it gets rerun. That's because Router.current() looks for changes in the route(or URL). But in any of above cases, appId didn't get changed.
Because of this, a lot parts of our app get re-run and re-rendered. This creates unpredictable rendering behaviour in our app.
FlowRouter fixes this issue by providing the Router.getParam() API.
Seems like a valid point, can we get a similar exposed function in iron router?
router.current() is evil
Router.current() is evil. Why? Let's look at following example. Imagine we have a route like this in our app:
/apps/:appId/:section
Now let's say, we need to get appId from the URL. Then we will do, something like this in Iron Router.
Let's say we changed :section in the route. Then the above helper also gets rerun. If we add a query param to the URL, it gets rerun. That's because Router.current() looks for changes in the route(or URL). But in any of above cases, appId didn't get changed.
Because of this, a lot parts of our app get re-run and re-rendered. This creates unpredictable rendering behaviour in our app.
FlowRouter fixes this issue by providing the
Router.getParam()
API.Seems like a valid point, can we get a similar exposed function in iron router?