I am new in react-native coding but have experienced on objective-c and swift coding and want use singleton pattern in react-native. I have tried to find out the solution fr
Here's my implementation for singleton class...
Controller.js
export default class Controller { static instance = Controller.instance || new Controller() helloWorld() { console.log("Hello World... \(^_^)/ !!") } }
Usage:
import Controller from 'Controller.js' Controller.instance.helloWorld()