Coder Social home page Coder Social logo

Comments (8)

larrymyers avatar larrymyers commented on July 25, 2024

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.

from react-mini-router.

pjdevries avatar pjdevries commented on July 25, 2024

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?

from react-mini-router.

larrymyers avatar larrymyers commented on July 25, 2024

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.

from react-mini-router.

pjdevries avatar pjdevries commented on July 25, 2024

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.

from react-mini-router.

pjdevries avatar pjdevries commented on July 25, 2024

I accidentally closed the topic, so this comment is just to reopen it :)

from react-mini-router.

pjdevries avatar pjdevries commented on July 25, 2024

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

from react-mini-router.

larrymyers avatar larrymyers commented on July 25, 2024

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

from react-mini-router.

pjdevries avatar pjdevries commented on July 25, 2024

Thanks for the swift reply.
I would not dare asking any questions, if I wouldn't at least have read the documentation more than once. Either I'm not smart enough and miss the necessary experience and background knowledge (the most obvious reason) or the documentation is not as clear as you assume ;)
Don't worry, I'll try to figure something out.

from react-mini-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.