What can I use instead of EventEmitter in react-native?

Viewed 1232

I'm new to react-native. And I was playing around creating a js class where I want to support events so other systems can subscribe. I tried using EventEmitter but I noticed it is not exported in react-native 0.64, so I'm curiuous what else can I use to achive this.

class FMyEventClass{
  constructor() {
    this.FMyEvent = new EventEmitter();
    setTimeout(this.Foo, 5000);
  }

  OnMyEvent(MyEventHandler) {
    return this.FMyEvent.addListener('MyEvent', MyEventHandler);
  }

  Foo() {
    this.FMyEvent.emit('MyEvent', { NewState: EAppLoginState.Register });
  }
}

1 Answers
Related