supasate/connected-react-router

When moving to <Link>, LOCATION_CHANGE is called twice.

joyfuI opened this issue · 4 comments

I am migrating a project that used react-router-redux to connected-react-router.

Looking through the console logs, I noticed that LOCATION_CHANGE was being called twice every time a page was navigated.

Here is the reproduction code.
https://codesandbox.io/s/connected-react-router-0tbdu

Is this the correct behavior?

I see the same behavior (twice LOCATION_CHANGE) even when dispatch the push action.
Relative issue: #318

I found the cause. StrictMode is the cause.

After further searching, I found the following article:
https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects

It's probably caused by two renderings in development mode with StrictMode.

@joyfuI you are right, thanks your useful advice

So should we just not use this library in conjunction with Strict Mode? Surely Strict Mode has a lot of benefits. What exactly is the issue with history as per #318?