I am building a React-Native SDK library based on Swift/Kotlin modules, and I want to deliver the best UX to those, who will use it.
I could not notice how AppDelegate didFinishLaunchingWithOptions
is similar to React useEffect
, so I've really started to wonder whether we can replicate such behavior inside the JS code.
I did some tests, comparing useEffect
inside a core component with a function inside didFinishLaunchingWithOptions
, so the only difference I found is:
useEffect
certainly executes only after the application started, while the iOS function would be executed during startup
I presumed, that useEffect
would execute a closure every time the app is opened, but in a core component, it seems to behave the right way.
So how different is creating an SDK initialization inside, for example, useEffect
and calling it from where they always put it: didFinishLaunchingWithOptions
inside AppDelegate