null is not an object evaluating ‘RNOneSigna l.setAppId’

I have created an account at Onesignal website and got my App ID,
and installed react-native-onesignal version ^4.0.3.
React Native ver: 0.63.4

Copy pasted the config on the documentation

useEffect(() => {
/* O N E S I G N A L   S E T U P */
  OneSignal.setAppId("MY_APP_ID");
  OneSignal.setLogLevel(6, 0);
  OneSignal.setRequiresUserPrivacyConsent(false);
  OneSignal.promptForPushNotificationsWithUserResponse(response => {
    OSLog("Prompt response:", response);
  });
}, [])

But im getting error:
null is not an object evaluating 'RNOneSigna l.setAppId',

1 possible answer(s) on “null is not an object evaluating ‘RNOneSigna l.setAppId’

  1. The same here, the documentation is incomplete and only available in class components, 2021 using clases, yep: Onesignal.
    The second if you browse into the /examples you will only find in TS.

    Use this repo, it’s better than Onesignal:

    Example