SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 155 C++

Cxx TurboModules > Add example to return a JS function from Cxx to JS (#41385)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41385

Changelog: Internal

Adding a Cxx TM example which adds a listener and returns a subscription to remove that listener from the TM.

You should be able to use this with React Hooks - https://legacy.reactjs.org/docs/hooks-reference.html

E.g.

```
useEffect(() => {
  const subscription =  NativeCxxModuleExample.setValueCallbackWithSubscription(
          callbackValue => // use it
        );
  return subscription;
});
```

Reviewed By: shwanton

Differential Revision: D50473063

fbshipit-source-id: 4e9b92aeccff1771eb4ffad6bdaa20ba7f18435f
C
Christoph Purrer committed
9320174df4239058125b8876a0623230f6e03b02
Parent: 01b4d78
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 11/9/2023, 7:38:54 PM