Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Last active September 20, 2018 06:10
Show Gist options
  • Save Sawtaytoes/74c3448fbcd8913a73fc635a5b1be916 to your computer and use it in GitHub Desktop.
Save Sawtaytoes/74c3448fbcd8913a73fc635a5b1be916 to your computer and use it in GitHub Desktop.
Advanced use of `ReduxConnection` to compose other Redux-stateful components.
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