import React from 'react'
import { Text } from 'react-native'
import { useDoormanUser } from 'react-native-doorman'
const UserDetails = () => {
const { signOut } = useDoormanUser()
return <Text onPress={signOut}>Sign Out!</Text>
}
export default UserDetails
import React from 'react'
import { Text } from 'react-native'
import { withDoormanUser } from 'react-native-doorman'
function UserDetails(props) {
// receives a user prop
const { signOut } = props.user
return <Text onPress={signOut}>Sign Out!</Text>
}
export default withDoormanUser(UserDetails)
import React from 'react'
import { Text } from 'react-native'
import { withDoormanUser } from 'react-native-doorman'
class UserDetails extends React.Component {
render() {
// access via this.props.user
const { signOut } = this.props.user
return <Text onPress={signOut}>Sign Out!</Text>
}
}
export default withDoormanUser(UserDetails)
withDoormanUser and useDoormanUser should only be used on screens that show up after a user has signed in. If you use either one in a component when the user hasn't authenticated yet, it will throw an error.