MDB admin template


Topic: MDB admin template

roshanpr pro asked 6 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)


roshanpr pro answered 6 years ago

Found the fix. Silly mistake from my side

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

Was using ":" instead of "="


Anna Morawska staff answered 6 years ago

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


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
  • User: 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