Router: Reach Router doesn't work as expected with Material UI Tabs integration

Created on 2 Jul 2019  路  2Comments  路  Source: reach/router

Hi,

I'm trying to integrate Reach Router with Material UI (see https://codesandbox.io/s/reach-router-starter-v1-cgvin?fontsize=14). When trying to change tabs, the active state of the tab doesn't quite work all the time though the route is changed.

Am I doing anything wrong?

Thank you very much for the lib,

Have a good day!

question

Most helpful comment

Hi,

I did a workaround using your example that would maybe help you.
I think the problem was you were handling the tab's change inside each tab instead the tabs container.
Also I changed the 'value' attribute from the tabs for 'index' that could be more readable.

I hope this help you :)

https://codesandbox.io/s/reach-router-integration-with-material-ui-gycwh

PD: I've noticed that if you reload on tab2 or tab3, the tab1 is not working properly on codepen (You'll need to click twice to tab take the click event) but I've tried on my local and seems work!

All 2 comments

Hi,

I did a workaround using your example that would maybe help you.
I think the problem was you were handling the tab's change inside each tab instead the tabs container.
Also I changed the 'value' attribute from the tabs for 'index' that could be more readable.

I hope this help you :)

https://codesandbox.io/s/reach-router-integration-with-material-ui-gycwh

PD: I've noticed that if you reload on tab2 or tab3, the tab1 is not working properly on codepen (You'll need to click twice to tab take the click event) but I've tried on my local and seems work!

Hi, thank you very much for the answer!

Actually, I did some refactoring on my code and it sort of fixed itself but I keep handling the changes inside each tab.
I don't know why it wouldn't work in the first place though...

Anyways, cheers :rocket:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danoc picture danoc  路  3Comments

ryanflorence picture ryanflorence  路  4Comments

maieonbrix picture maieonbrix  路  4Comments

hardfist picture hardfist  路  3Comments

michaelwiktorek picture michaelwiktorek  路  4Comments