# Fix "[antd: Menu] `children` will be removed in next major version. Please use `items` instead"

Yes. An agent finds every <Menu.Item> tree, rewrites each Menu with an items array and each Dropdown overlay as menu, renders them warning-free and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/fix-antd-menu-children-will-be-removed-warning/antd/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent clones the repository into its own cloud sandbox and reads where the warning comes from. In a React dashboard like bittorrent/btfs-dashboard, the BTFS node dashboard at 4.0.0, `package.json` pins `"antd": "4.24.14"`, `"react": "17.0.1"`, `react-router-dom` 5.2.0 and `tailwindcss` 2.0.4, with `start`, `build` and `test` pointing at the ejected `scripts/*.js` and a `jest` 26 configuration but no test files under `src/`. A search for `<Menu` finds four files that still build menus from children: `src/views/admin/Cheque.js` lines 21 to 33, a horizontal `<Menu>` with two `<Menu.Item>` keys, `chequeEarning` and `chequeExpense`, whose `onClick` sets the shown panel; `src/components/Cards/CardChequeEarningList.js` lines 60 to 75 with `cashList`, `cashHistory` and `chequeDetail`; `src/components/Cards/CardChequeExpenseList.js` from line 20; and `src/components/Login/Login.js`, where two menus, `connectMenu` (TRONLink and MetaMask) and `logoutMenu`, are passed to `<Dropdown overlay={...}>` at lines 58 and 67.

Then it reproduces the warning without a browser. Rendering one of those menus through `react-dom/server` with `NODE_ENV=development` prints `Warning: [antd: Menu] children will be removed in next major version. Please use items instead.` on antd 4.24.14 (antd wraps `children` and `items` in backticks in the console), and rendering the login dropdown prints a second one, `Warning: [antd: Dropdown] overlay is deprecated. Please use menu instead.` Both are antd's own development-mode warnings, so they appear in the dev server console on every page that mounts these components and disappear only in the production build.

The fix is the `items` API antd 4.20 introduced and antd 5 requires. Each `<Menu.Item key="x">content</Menu.Item>` becomes an object `{ key: 'x', label: content }` in an array passed as `items`, with the same `className` carried on the item, and `onClick` and `selectedKeys` stay on the `<Menu>` exactly as they are. In `Login.js` the two overlay menus become `menu={{ items }}` on each `<Dropdown>`, which removes the `overlay` warning in the same edit. Rendered the same way, the `items` form prints nothing.

It then runs the production build, `node scripts/build.js`, which completes on Node 22 with webpack 5 and ends with `The build folder is ready to be deployed` and a bundle-size note the repository already had. With no tests to run, the server render before and after each file is the proof, and the agent pastes both into the description, together with the list of the four files and eleven menu entries it rewrote.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "The dev console prints `[antd: Menu] children will be removed in next major version. Please use items instead`. Read package.json for the antd and React versions, then list every file that renders <Menu.Item>, <Menu.SubMenu> or passes a Menu to a Dropdown as overlay, with line numbers. Reproduce the warning by rendering one of those components with react-dom/server in development mode and quote it. Rewrite each Menu with an items array that keeps every key, label, className and handler, and each Dropdown overlay as menu={{ items }}; render again to show the warning is gone. Run the production build and quote its last lines. Do not upgrade antd in this change. Open a pull request that lists each file and the number of entries it converted.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request touching the four files, `Cheque.js`, `CardChequeEarningList.js`, `CardChequeExpenseList.js` and `Login.js`, with each `<Menu>` now taking an `items` array and each `<Dropdown>` a `menu` prop, and no change to `package.json`. The description quotes both antd warnings from the server render on 4.24.14, lists the keys of every converted entry, and ends with the build's closing lines.

A reviewer checks that every `key` survived, since `selectedKeys` and the `onClick` handlers in `Cheque.js` and the card lists compare against them, that the `className` values moved onto the item objects, and that the labels in `Login.js` still carry their `id` attributes and click handlers. The run's record holds the renders and the build, so the warning's disappearance can be read rather than assumed.

## Run it on every Linear issue labelled tech-debt

Add an automation to the repository's Project with a `linear` trigger on issues labelled `tech-debt` and this prompt. When someone files the antd 5 preparation issue and labels it, the run starts with the issue placed after the prompt, converts every children-based Menu it finds and opens a pull request that links the issue; an issue about a different component ends with a report and no code change.

The same body works from your own server with `POST /o/{org}/sessions` and an API key, sending a `request_id` that is a UUID v5 of the issue id so a retried call returns the run it already started; the key's `webhook_url` then receives `run.completed` with the pull request.

## Why run it on Rush?

A development-mode warning from a UI library is only visible with the app running in a browser, which is why it lingers. The agent reproduces it with a server render in its own sandbox, quotes the exact text from the installed antd, and keeps every render and the production build in the run's record, so the pull request shows the warning gone rather than asserting it.

The conversion is mechanical but spread across files, and the keys are what the app's state compares against. Doing it in one run with a list of every entry, checked by the same render on each file, is safer than converting menus one at a time as they are noticed.

## Frequently asked questions

### Why did antd deprecate Menu children?

antd 4.20 moved `Menu`, `Dropdown` and the other menu-based components to data-driven `items` arrays so the library can control rendering and keys without walking JSX children. antd 5 removed the children form, so the warning in 4.24 is the last release that still accepts both.

### Does this upgrade antd to 5?

No. The `items` form works on the installed 4.24 and is a prerequisite for 5, which also changes theming and drops the less-based styles. The agent keeps antd pinned and names the 5 upgrade as its own change in the description.

### What about the Dropdown overlay warning?

It is the same deprecation seen from the other side: a `Dropdown` with `overlay={<Menu>...}` warns because the overlay is a children-based Menu. Passing `menu={{ items }}` instead fixes both warnings at once, which is why `Login.js` is in the same pull request.

### Will the menus look or behave differently?

Not on 4.24: `items` renders the same DOM, and `selectedKeys`, `mode` and `onClick` stay on the `Menu`. The server render before and after is included so the markup can be compared, and the keys are listed so a reviewer can check the handlers that read `e.key`.

## More jobs like this: Turn a Linear label into a PR

- [Fix "AttributeError: 'array.array' object has no attribute 'tostring'" on Python 3.9 and Later](https://getrush.ai/run/fix-array-tostring-attribute-error/array/)
- [Fix "AttributeError: module 'asyncio' has no attribute 'coroutine'"](https://getrush.ai/run/fix-asyncio-coroutine-attribute-error/asyncio/)
- [Fix the body-parser "provide extended option" Deprecation Warning in Express](https://getrush.ai/run/fix-body-parser-extended-option-deprecation/body-parser/)
- [Fix "AttributeError: module 'cgi' has no attribute 'escape'" on Python 3.8 and Later](https://getrush.ai/run/fix-cgi-escape-attribute-error/cgi/)
- [Fix "Deprecated: Creation of dynamic property is deprecated" in PHP 8.2](https://getrush.ai/run/fix-creation-of-dynamic-property-deprecated/php/)
- [Fix "DeprecationWarning: datetime.datetime.utcnow() is deprecated" on Python 3.12](https://getrush.ai/run/fix-datetime-utcnow-deprecation-warning/datetime/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
