Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Uncaught TypeError: t is undefined

Open
#255 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
frontend

Research direction

Start with the linked CodeSandbox and reproduce the failure by right-clicking the element using useContextMenu({ id: MENU_ID }) and show. Trace the interaction between show, Menu, and Item until the undefined value is identified. Done means right-clicking opens the menu without the TypeError and the item handler still receives its documented arguments.

Written by the indexing model from the issue text.

Description

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

When I right click, I get Uncaught TypeError: t is undefined - full stack below.

My code is:

const MENU_ID = 'MyMenu'

const MyThing = ({....}) => {
    const { show } = useContextMenu({
        id: MENU_ID,
    });

    ...

    function handleItemClick({ event, props, triggerEvent, data }){
        console.log(event, props, triggerEvent, data );
    }

    return (
        <div>
            ...
            <Menu id={MENU_ID}>
                <Item onClick={handleItemClick}>One</Item>
                <Item onClick={handleItemClick}>Two</Item>
            </Menu>
            <div onContextMenu={show}><p>some stuff here</p></div>
            ...
        </div>
    )
}

When I right click I get this in console:

22:08:38.790 Uncaught TypeError: t is undefined
    show bundle.js:68203
    show bundle.js:68216
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 15
    js index.js:7
    factory react refresh:6
    Webpack 3
2 bundle.js:68203:5
    show bundle.js:68203
    show bundle.js:68216
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 8
    forEach self-hosted:4425
    React 7
    js index.js:7
    factory react refresh:6
    Webpack 3

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

Sure, though I get a slightly different stack trace (X is not a function) on CodeSandbox: https://codesandbox.io/s/react-contexify-issue-255-t6fthr

What is the expected behavior?

It doesn't fail.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Firefox 117 (Linux), CodeSandbox.

React 17.0.2, Contexify 6.0.0

Dominant language
TypeScript
Stars
1.2k
Forks
133
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fkhadra/react-contexify

All issues in fkhadra/react-contexify

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.