-
Notifications
You must be signed in to change notification settings - Fork 38
All routes rendered twice #23
Comments
Can you provide any code in your project where you think the issue is? If you are seeing routes rendering multiple times for a single action, it likely means that you have DOM event that isn't being trapped and is propagating beyond the scope of the RouterMixin. Check out the example app in react-mini-router. It's a functional React application, maybe that can give you some code you can use. |
Thanx for the swift response. Not sure which code I can provide, since I don't know where the issue is :) What I can see, is that the router executes setState() twice: first in handleClick() and a second time in onPopState(). It only happens when navigating from one route to another. If I click the active menu item, only handleClick() is executed. Does that help? |
It shouldn't be calling popState and handleClick in the same render cycle. If this is happening it means something your application is triggering navigation beyond just the href in the anchor tag. |
I suppose popState and handleClick are called under different circumstances. Can you give me a clue under which circumstances? It might make it easier for me to pinpoint the problem. |
I accidentally closed the topic, so this comment is just to reopen it :) |
Hey Larry, Have you given my last question any thought? I have a new question: if my app is not always in the web root (different for development and productrion), how do I configure the router and the url's in my links, so that they always get routed correctly? Thanks in advance. Kind regards, Pieter-Jan de Vries |
See the docs about configuring the router to mount at a specific path as the root path: https://github.com/larrymyers/react-mini-router#configuration |
Thanks for the swift reply. |
Hi Larry,
Thanks for react-mini-router. I'm quite new to JavaScript, React and react-mini-router, so I apologize beforehand for asking for the obvious or being rather clumsy in my explanations :)
It seems that react-mini-router renders all my routes twice, each time I click one of my menu links. Can you give me any clues why that might happen and how it can be avoided?
Regards,
Pieter-Jan de Vries
The text was updated successfully, but these errors were encountered: