alpertuna / react-metismenu-router-link

Router link extension for `react-metismenu` menu component.
https://www.npmjs.com/package/react-metismenu-router-link
MIT License
8 stars 14 forks source link

Sub-menu's collapse when clicked upon #1

Closed pcable closed 7 years ago

pcable commented 7 years ago

I'm attempting to replicate the demo functionality. However whenever I click on "sub-menu" the "Menu 3" collapses. I need this to remain open as it does in your demo.

But I must be missing something.

I can still navigate to the url and it will show the correct item. It's just this collapse on click that I need to change. Am I missing something or is this a bug. Which version is the demo using?

alpertuna commented 7 years ago

I got the point. I tried and realized that there is a problematic part on demo as you are right. menu content object assignment have to be at outside App render metod. Since new content is created at each render, react-metismenu supposes content has been changed.

Wrong example;

const App = props = {
  const menu = [...];
  return <MetisMenu content={menu} />
}

Correct example;

const menu = [...];
const App = props = {
  return <MetisMenu content={menu} />
}

I will correct demo example source.

pcable commented 7 years ago

Thanks, that works great now.

On Fri, Nov 18, 2016 at 8:50 PM, H.Alper Tuna notifications@github.com wrote:

I got the point. I tried and realized that there is a problematic part on demo as you are right. menu content object assignment have to be at outside App render metod. Since new content is created at each render, react-metismenu supposes content has been changed.

Wrong example;

const App = props = { const menu = [...]; return }

Correct example;

const menu = [...];const App = props = { return }

I will correct demo example source.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alpertuna/react-metismenu-router-link/issues/1#issuecomment-261524531, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOXFreYJfW_9l6BCrmXSDVTMTO6ERmdks5q_Z79gaJpZM4K2ZCV .

alpertuna commented 7 years ago

Demo source example has been fixed. Thanks for your report :blush: