Last active
September 20, 2018 03:31
-
-
Save Sawtaytoes/e40250da4795749976c626949d7bfd63 to your computer and use it in GitHub Desktop.
`IsAuthenticated` React component using react-redux's `connect`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { connect } from 'react-redux' | |
import { authInfoSelector } from '~/redux/auth/selectors' | |
export const IsAuthenticated = ({ | |
children, | |
hasReceivedAuthInfo, | |
isAuthenticated, | |
}) => ({ | |
hasReceivedAuthInfo | |
&& isAuthenticated | |
&& children | |
) | |
export default ( | |
connect( | |
authInfoSelector | |
)( | |
IsAuthenticated | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment