#Cannot read properties of undefined (reading 'getStackAddendum')

25 messages · Page 1 of 1 (latest)

haughty lodge
#

Hello, I am getting an error when we want to use the following code exactly.

<Menu shadow="md" width="{200}">
  <Menu.Target>
    <Button>Toggle menu</Button>
  </Menu.Target>
  <Menu.Dropdown>
    <Menu.Label>Application</Menu.Label>
    <Menu.Item>Settings</Menu.Item>
  </Menu.Dropdown>
</Menu>
sage fable
#

not sure how relevant they are to your problem but two things to try

  1. your Menu width is in the wrong format, either put width={200}or width="200px"
  2. try using Mantine's Button rather than native html button
haughty lodge
#

1 . Width is given as string and number, there is no problem in this,
2. This example is taken directly from mantine.dev.

sage fable
#

in jsx syntax you typically wrap the {} around the variable, this example has it the opposite way around

haughty lodge
#

I used the following example directly, I did not do anything like addition.
https://mantine.dev/core/menu/

Combine a list of secondary actions into single interactive area

sage fable
#

there is a difference here

#

your example
width="{200}"

#

this is not properly specified

#

basically, a prop with {} can contain any literal. a prop with "" is a string

#

what your example does is pass a string but then open literal brackets inside it, which won't be parsed correctly

haughty lodge
#

Ok, that's okay, even if I remove the width field, I still get the same error.

where it made a mistake
This is where <Menu.Target> is when I remove it, the error does not occur, but it does not meet my needs in this case.

haughty lodge
#

When we use <Menu.Dropdown> or <Menu.Target> in this way, it gives the error on this line, so when we use Menu.(....) it gets an error.

sage fable
#

perhaps there is an issue with dependency versions

#

what mantine versions do you have in package.json?

haughty lodge
sage fable
#

can you show me your package.json?

#

but yes - if you're using the mantine.dev docs, it will probably be invalid syntax

haughty lodge
#

Yes, the syntax has changed, the project is built entirely on 4, and I will have to use the v4 document, since it will be very costly now to switch it to version 5.

Thank you very much for your interest.

sage fable
#

great, hope that fixes your issue

if your project ever wants to switch to v5, most of the changes are listed on the release changelog
https://mantine.dev/changelog/5-0-0/

it isn't too hard to upgrade, i have solo hobby projects with thousands of lines, the upgrade took just over an hour of work

React components and hooks library with native dark theme support and focus on usability, accessibility and developer experience