The New Way to Build! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Learn More

Stepper or DrawerComponent not opening after reload in react


Hi,

We have faced an issue when the page is directly loaded from url or reloaded and has a button to a Drawer or Stepper component, sometimes it does nothing when we click on it. We have to navigate away and back for it to work. How could this be fixed?

Thank you for your help!


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi,

Try to create a separate small component with these buttons, and try to add the next code in this component:

useEffect(() => {
MenuComponent.reinitialization() // import from _metronic/assets/ts/components
}, [])



Regards,
Keenthemes support



Hi Carmelo,

Thanks for your reply. I did what you said, but when I reload, the button doesn't activate the drawer. Once I navigate somewhere and back, it works again like before. It seems this didn't change the behaviour.

What could be the issue?

Thanks!

p.s.: The drawer component is located in the parent component of the button.



I found the issue:

For the drawer, I had to use: DrawerComponent.reinitialization()
and now it works!

Thank you for your help!



Nice to see that you found the working solution.

Regards,
Keenthemes support


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(