Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-global-store
Advanced tools
connect
wrapperuseGlobalStore
.Install React Native Async Storage (required) if not installed.
Then install React Native Global Store
npm i react-native-global-store
- OR -
yarn add react-native-global-store
No Linking or Pods are needed, you are ready to go!
initialState?: object;
// Optional Initial State, defaults to {}
persistedKeys?: string[];
// Optional keys to persist its values ( white list to persist )
loadingUI?: JSX.Element;
// Optional Loading UI, defaults to : <View/>
storageKey?: string;
// Optionally change Async Storage Key, default key is "GlobalStoreProvider"
import { GlobalStoreProvider } from "react-native-global-store"
import React from "react"
import { GlobalStoreProvider } from "react-native-global-store"
import AppContainer from "../navigation" // Path to Root Navigation
const myInitialState = { /* your initial state */ }
export default ()=> (
<GlobalStoreProvider
initialState={myInitialState}
loadingUI={<MyLoadingUI />}
persistedKeys=["user", "otherKey"] // Changes to these keys' values will be persisted.
>
<AppContainer />
</GlobalStoreProvider>
)
import { useGlobalStore } from "react-native-global-store"
const [globalState, setGlobalState] = useGlobalStore()
import React from "react"
import { useGlobalStore } from "react-native-global-store"
const MyComponent = (props) => {
const [globalState, setGlobalState] = useGlobalStore()
// Then access and edit your globalState normally
// Just like useState from React.
return (
<>
// Your Component goes here
</>
)
}
export default MyComponent
Componenet: ComponentClass
import React from "react"
import { connect } from "react-native-global-store"
class UserPage extend React.Component {
// Your Component goes here
// Access your store using this.props.yourKey
// Update your store state using this.props.setGlobalState({})
}
// this will connect your global store to UserPage component props
export default connect(UserPage)
FAQs
React Native App Store state holder and persistor
The npm package react-native-global-store receives a total of 1 weekly downloads. As such, react-native-global-store popularity was classified as not popular.
We found that react-native-global-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.