Skip to content

Commit c389f54

Browse files
Update index.js
1 parent d915f84 commit c389f54

File tree

1 file changed

+2
-4
lines changed
  • website/frontend/src/components/CleanAir/SecondaryNav

1 file changed

+2
-4
lines changed

website/frontend/src/components/CleanAir/SecondaryNav/index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const SecondaryNavComponent = ({ disabledTabs }) => {
2222
if (currentTab !== -1 && !disabledTabs.includes(currentTab)) {
2323
dispatch(setActiveTab(tabs[currentTab]));
2424
}
25-
}, [location]); // Only re-run the effect if location changes
25+
}, [location]);
2626

2727
return (
2828
<div className="header-subnav">
@@ -31,9 +31,7 @@ const SecondaryNavComponent = ({ disabledTabs }) => {
3131
<Link to={`/clean-air/${tab.linkName}`} key={index}>
3232
<li
3333
className={`${
34-
location.pathname.includes(tab.linkName) || activeTab.linkName === tab.linkName
35-
? 'active'
36-
: ''
34+
location.pathname.includes(tab.linkName) || activeTab === index ? 'active' : ''
3735
} ${disabledTabs.includes(index) ? 'disabled' : ''}`}
3836
onClick={() => {
3937
if (!disabledTabs.includes(index)) {

0 commit comments

Comments
 (0)