After integrating redux into my create-react-app project, I've been struggling to implement a navigator that highlights the active "page link." To achieve this functionality, I am using a combination of react hooks (to maintain the current page state) and the npm package called classNames.
The code snippet I'm utilizing for this purpose is:
classNames(object['key'] && classes.activeItem)
In this setup, when object['key']
evaluates to true for a specific item activation, the corresponding element receives the activeItem
class.
Interestingly, when I replace object['key']
with simply true
, it functions as expected. Additionally, upon clicking the item, logging the value of object['key']
also returns true.
However, despite these observations, the mechanism seems to be malfunctioning. Any insights on why this might be happening would be greatly appreciated!
import React, { useEffect, memo } from 'react';
import { bindActionCreators, compose } from 'redux';
import { connect } from 'react-redux';
...