In react-native project. It has code paragraph:
import OneSignal from 'react-native-onesignal'
import { REGEX } from '@/Constants/Regex'
const getPushToken = async () => {
const state = await OneSignal.getDeviceState()
let identifier = state?.pushToken
return identifier
}
I must change this code to reactjs to render in my web. How can I chage this code? I tried to paste this code in to my reactjs project, I imported OneSignal
from react-onesignal
. However, it rendered the error when I run it function
TypeError: react_onesignal__WEBPACK_IMPORTED_MODULE_1__.default.getDeviceState is not a function