React native- Best way to create singleton pattern

前端 未结 3 1973
滥情空心
滥情空心 2020-12-31 10:32

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

3条回答
  •  执笔经年
    2020-12-31 11:00

    The singleton pattern isn't used much in the JS ecosystem. What you should look into is http://mobx.js.org. MobX is a library that allows you to create observable objects to store data for your apps. You instantiate one store for each domain you please and make edits to that store to change app state.

提交回复
热议问题