Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Last active September 20, 2018 03:31
Show Gist options
  • Save Sawtaytoes/e40250da4795749976c626949d7bfd63 to your computer and use it in GitHub Desktop.
Save Sawtaytoes/e40250da4795749976c626949d7bfd63 to your computer and use it in GitHub Desktop.
`IsAuthenticated` React component using react-redux's `connect`.
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