Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: MDB admin template

roshanpr pro asked 5 years ago


There is a prop called onChange for the Routes component. A function is being passed as an argument for the onChange.

this.assessLocation()} />

The function definition is like below:

assessLocation = (location) => { let locationString;

  switch(location) {
    case '/status':
      locationString: 'Dashboard'
      break;

this.setState({
    currentPage: locationString
  })
}

Problem is that I am unable to get the locationString to show up in the TopNav even though I have.

{this.props.routeName}

I tried to bind the assessLocation function but still does not work. The assessLocation function takes an argument but in the Routes component, there is no argument being passed. Could this be an issue?

Everything works fine except that the location string is not showing up on the topnav (using this as a breadcrumb)


Anna Morawska staff answered 5 years ago


Great, thanks for sharing your solution with us. Best, Ania


roshanpr pro answered 5 years ago


Found the fix. Silly mistake from my side

switch(location) { case '/status': locationString= 'Dashboard' break;

Was using ":" instead of "="



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.7.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Mac
  • Provided sample code: No
  • Provided link: No
Tags