{"record":{"id":"963cbb6f5af1169a","repo":"pmndrs/react-three-fiber","slug":"handler-for-eventname-was-not-found-you-must-p","errorCode":null,"errorMessage":"Handler for ${eventName} was not found. You must pass event names in camelCase or name of the handler https://github.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr.md#create-fireevent","messagePattern":"Handler for (.+?) was not found\\. You must pass event names in camelCase or name of the handler https://github\\.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr\\.md#create-fireevent","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/test-renderer/src/fireEvent.ts","lineNumber":27,"sourceCode":"\nexport const createEventFirer = (act: Act, store: RootStore) => {\n  const findEventHandler = (\n    element: ReactThreeTestInstance,\n    eventName: string,\n  ): ((event: MockSyntheticEvent) => any) | null => {\n    const eventHandlerName = toEventHandlerName(eventName)\n\n    const props = element.props\n\n    if (typeof props[eventHandlerName] === 'function') {\n      return props[eventHandlerName]\n    }\n\n    if (typeof props[eventName] === 'function') {\n      return props[eventName]\n    }\n\n    console.warn(\n      `Handler for ${eventName} was not found. You must pass event names in camelCase or name of the handler https://github.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr.md#create-fireevent`,\n    )\n\n    return null\n  }\n\n  const createSyntheticEvent = (element: ReactThreeTestInstance, data: MockEventData): MockSyntheticEvent => {\n    const raycastEvent = {\n      camera: store.getState().camera,\n      stopPropagation: () => {},\n      target: element,\n      currentTarget: element,\n      sourceEvent: data,\n      ...data,\n    }\n    return raycastEvent\n  }\n","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/pmndrs/react-three-fiber/blob/ff3899dbf43d2a88895fecf53c147192abfd7431/packages/test-renderer/src/fireEvent.ts#L9-L45","documentation":"fireEvent looks up the handler for eventName on the instance's props; when no prop matching that name is a function, it warns that the handler was not found and reminds you that event names must be camelCase (e.g. onClick) or be the exact handler prop name. The event is then not delivered because there is nothing to call.","triggerScenarios":"Calling fireEvent(instance, 'click') or fireEvent(instance, 'Click') when the element was rendered with onClick={fn}; or firing an event name the element never received a handler prop for.","commonSituations":"Porting tests from RTL where lowercase names worked, typos in event names, firing on an element whose handler lives on a different node in the R3F tree, or handler attached via pointer-events config rather than props.","solutions":["Use the exact camelCase handler prop name: fireEvent(mesh, 'onClick') not 'click'","Verify the target instance actually has the handler: Object.keys(instance.props) before firing","Fiber the event on the element that declares the handler (e.g. the mesh with onClick), not a parent group","Update @react-three/test-renderer to get current fireEvent semantics"],"exampleFix":"// before\nfireEvent(mesh, 'click')\n\n// after\nfireEvent(mesh, 'onClick')","handlingStrategy":"type-guard","validationCode":"const hasHandler = (instance: any, eventName: string) => typeof instance?.props?.[eventName] === 'function'\nif (hasHandler(mesh, 'onClick')) fireEvent(mesh, 'onClick')","typeGuard":"const hasEventHandler = (instance: any, eventName: string): eventName is 'onClick' | 'onPointerOver' | (string & {}) =>\n  typeof instance?.props?.[eventName] === 'function'","tryCatchPattern":null,"preventionTips":["Always fire the camelCase handler prop name ('onClick', not 'click')","Assert handler presence before firing to turn the warning into a test failure","Fire on the exact element whose props declare the handler"],"tags":["test-renderer","fireevent","event-naming","camelcase"],"backgroundTag":"event-handler-not-found","analyzedSha":"ff3899dbf43d2a88895fecf53c147192abfd7431","analyzedAt":"2026-08-28T10:16:38.568Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}