Last active
September 20, 2018 06:10
-
-
Save Sawtaytoes/74c3448fbcd8913a73fc635a5b1be916 to your computer and use it in GitHub Desktop.
Advanced use of `ReduxConnection` to compose other Redux-stateful components.
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 { ReduxConnection } from '@ghadyani-framework/redux-components' | |
import { authInfoSelector } from '~/redux/auth/selectors' | |
const IsAuthenticated = ({ | |
children, | |
}) => ( | |
<ReduxConnection selector={authInfoSelector}> | |
{({ | |
hasReceivedAuthInfo, | |
isAuthenticated, | |
}) => ( | |
hasReceivedAuthInfo | |
&& isAuthenticated | |
&& children | |
)} | |
</ReduxConnection> | |
) | |
export default IsAuthenticated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment