microsoft / microsoft/react-native-windows-samples

[Docs] Improve Turbo Module docs for EventEmitter

Open
#1,154 1 comment 0 reactions 1 assignee View on GitHub

@HariniMalothu17 is already working on this.

Since Feb 23, 2026.

documentation enhancement
Dominant language
C#
Stars
544
Forks
218
PR merge metrics
No merged PRs in 30d

Description

Summary

When writing a Turbo Module that contains an EventEmitter, you need to change your struct annotation from REACT_MODULE to REACT_TURBO_MODULE in order for the JS EventEmitter to be returned from the module.

It might be nice to include an example somewhere that shows a module that uses REACT_TURBO_MODULE and subscribes to the EventEmitter so users know when to use that over REACT_MODULE.

Motivation

I was running into an issue where I was trying to subscribe to an event in a turbo module:

  useEffect(() => {
    const subscription = NativeIRMenuItemManager.onMenuItemPressed(handleMenuItemPressed)
    return () => {
      subscription.remove()
    }
  }, [handleMenuItemPressed])

But the function kept throwing an error saying that the function was undefined. After more troubleshooting than I care to admit, I eventually ran across this PR that mentions the usage of REACT_TURBO_MODULE. I was following the Native Modules docs and looking at this example and both of them use REACT_MODULE so I didn't know that REACT_TURBO_MODULE existed.

Basic Example

No response

Open Questions

No response

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.