0.1.0 • Published 8 years ago
react-native-authentication-helpers v0.1.0
react-native-authentication-helpers
If you want to set up some super basic authentication in your app, this might be for you.
import {
setUser,
getUser,
clearUser,
withUser,
loadUserAsync,
} from 'react-native-authentication-helpers';UserType: anything that can save to AsyncStorage.setUser(user: UserType): set the user (eg: when you sign in).getUser(): UserType: get the user (eg: if you need to grab user data outside of a component).clearUser(): clear the user (eg: when you sign out).withUser(Component: ReactComponent)- a higher order component that passes in auserprop and is updated whenever it changes.loadUserAsync(): Promise<UserType?>- load user data fromAsyncStorage-- the user is returned but you don't need to do anything with itsetUser,clearUserautomatically persist changes toAsyncStorage.setUser,clearUser, andloadUserAsyncall emit updates for components wrapped by thewithUserHOC
0.1.0
8 years ago