specific-silverS
Refine3y ago
17 replies
specific-silver

useNavigation() with Dropdown

Hi! I'm trying to use the useNavigation() hook with Antd's dropdown. I had

const items = {
        items: [
            {
                key: '1',
                label: 'a',
                onclick: create('a')
            },
            {
                key: '1',
                label: 'b',
                onclick: create('b')
            },
            {
                key: '1',
                label: 'c',
                onclick: create('c')
            },
            {
                key: '1',
                label: 'Generic',
                onclick: create('d')
            },
        ]
    }


Which I changed to

const items = {
        items: [
            {
                key: '1',
                label: 'a',
                onclick: () => {create('a')}
            },
            {
                key: '1',
                label: 'b',
                onclick: () => {create('b')}
            },
            {
                key: '1',
                label: 'c',
                onclick: () => {create('c')}
            },
            {
                key: '1',
                label: 'd',
                onclick: () => {create('d')}
            },
        ]
    }


But the first will go to /a/create on loading the page, and the second does not work.

How should I go about this?
Was this page helpful?